Révision 1654

tmp/org.txm.groovy.core/src/java/org/txm/groovy/core/GroovyScriptedImportEngine.java (revision 1654)
1 1
package org.txm.groovy.core;
2 2

  
3 3
import java.io.File;
4
import java.util.ArrayList;
4 5
import java.util.Collection;
5 6
import java.util.List;
6 7
import java.util.logging.Level;
......
141 142
					Log.fine(GroovyMessages.errorImportNotCorrectlyEndedSeeConsoleMessages);
142 143
					
143 144
					if (!project.getDoUpdate()) { // clear all
144
						Log.fine("Deleting all project children...");
145
						for (TXMResult c : project.getChildren()) {
146
							c.delete();
147
						}
145
						project.deleteChildren();
148 146
					} else {
149 147
						Log.fine("Deleting all project CorpusBuild & Edition children...");
150 148
						for (TXMResult c : project.getChildren(CorpusBuild.class)) {
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/DeleteObject.java (revision 1654)
219 219

  
220 220
						//close corresponding editors
221 221
						for(Object obj : allObjectDeleted) {
222
							closeEditorOf(obj);
222
							closeEditorOf(obj, false);
223 223
						}
224 224
					} catch(Exception e) {
225 225
					}
......
305 305
	 * Close the editors which uses an Object.
306 306
	 *
307 307
	 * @param o the object used by an editor
308
	 * @param childnre close the editors of children too
308 309
	 */
309
	public static void closeEditorOf(Object o) {
310

  
310
	public static void closeEditorOf(Object o, boolean children) {
311
		if (!(o instanceof TXMResult)) {
312
			return;
313
		}
314
		
311 315
		TXMResult r = (TXMResult) o;
312 316
		List<TXMResult> all = new ArrayList<TXMResult>();//r.getDeepChildren();
313 317
		all.add(r);
314

  
318
		if (children) {
319
			all.addAll(r.getDeepChildren());
320
		}
315 321
		ArrayList<TXMEditor> editors = SWTEditorsUtils.getEditors();
316

  
317
		//FIXME use SWTEditorsUtils.getEditors()
318 322
		for (TXMResult tr : all) { // close editors of the result and its children
319 323
			for (TXMEditor<?> editor : editors) {
320 324
				if (tr == editor.getResult())	{
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenLocalizedWebPage.java (revision 1654)
138 138
			return OpenBrowser.openfile(getValidURL(URL_TEXTOMETRIE+"html/doc/manual/"+version+"/"+locale+"/manual1.xhtml", 
139 139
					URL_TEXTOMETRIE+"html/doc/manual/"+version+"/en/manual1.xhtml")); //$NON-NLS-1$
140 140
		} else if (PDFREFMAN.equals(key)) {
141
			return OpenBrowser.openfile(URL_TEXTOMETRIE+"files/documentation/Manuel%20de%20TXM%200.7%20FR.pdf/download"); //$NON-NLS-1$ 
141
			return OpenBrowser.openfile(URL_TEXTOMETRIE+"files/documentation/Manuel%20de%20TXM%200.8%20FR.pdf"); //$NON-NLS-1$ 
142 142
		} else if (BUG.equals(key)) {
143 143
			if (locale.equals("fr")) { //$NON-NLS-1$
144 144
				return OpenBrowser.openfile("https://groupes.renater.fr/wiki/txm-users/public/retours_de_bugs_logiciel"); //$NON-NLS-1$
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/ImportFormEditor.java (revision 1654)
68 68

  
69 69
	/** The meta. */
70 70
	MetadataPage meta;
71

  
72
	private ImportFormEditorInput finput;
71 73
	
72 74
	/**
73 75
	 * Instantiates a new import form editor.
......
121 123
	throws PartInitException {
122 124
		setSite(site);
123 125
		setInput(input);
124
		
126
		finput = ((ImportFormEditorInput) input);
125 127
		String txmhome = Toolbox.getTxmHomePath();
126
		File f = ((ImportFormEditorInput) input).getGroovyFile();
128
		File f = finput.getGroovyFile();
127 129
		String filepath = f.getPath();
128 130
		this.setGroovyscript(new File(txmhome, filepath));
129 131
		
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java (revision 1654)
71 71
import org.txm.rcp.editors.imports.sections.TextualPlansSection;
72 72
import org.txm.rcp.editors.imports.sections.TokenizerSection;
73 73
import org.txm.rcp.editors.imports.sections.UISection;
74
import org.txm.rcp.handlers.results.DeleteObject;
74 75
import org.txm.rcp.handlers.scripts.ExecuteImportScript;
75 76
import org.txm.rcp.messages.TXMUIMessages;
77
import org.txm.rcp.utils.SWTEditorsUtils;
76 78
import org.txm.utils.AsciiUtils;
77 79
import org.txm.utils.logger.Log;
78 80
import org.w3c.dom.Element;
......
894 896
	 */
895 897
	public boolean saveConfig() {
896 898
		Log.info(TXMUIMessages.savingImportParameters);
897

  
899
		
900
		if (project == null || project.getRCPProject() == null || !project.getRCPProject().exists()) {
901
			Log.warning("The corpus has been deleted since. Please re-open the import form.");
902
			this.getEditor().close(false);
903
			return false;
904
		}
905
		
898 906
		//		params.rootDir = project.getSrcdir().getAbsolutePath();
899 907
		//		project.scriptFile = editor.getGroovyScript().getName();
900 908

  
......
1019 1027
		project.setDirty();
1020 1028
		project.setDoUpdate(false);
1021 1029
		project.setNeedToBuild();
1030
		
1031
		DeleteObject.closeEditorOf(project, true);
1032
		
1022 1033
		ExecuteImportScript.executeScript(project);
1023 1034

  
1024 1035
	}
tmp/org.txm.core/res/org/txm/xml/xsl/filter-number-act-scene-line.xsl (revision 1654)
1
<?xml version="1.0"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xd="http://www.pnp-software.com/XSLTdoc" version="2.0">
3
 
4
  <xd:doc type="stylesheet">
5
    <xd:short>
6
      Feuille de style de numérotation d'éléments pouvant être utilisée comme
7
      prétraitement de l'import XML/w+CSV. Elle est conçue pour numéroter les
8
      actes, scènes et lignes de l'édition XML de la pièce "All's Well That Ends Well"
9
      de William Shakespeare suivante https://www.ibiblio.org/xml/examples/shakespeare/all_well.xml
10
    </xd:short>
11
    <xd:detail>
12
      This stylesheet is free software; you can redistribute it and/or
13
      modify it under the terms of the GNU Lesser General Public
14
      License as published by the Free Software Foundation; either
15
      version 3 of the License, or (at your option) any later version.
16
      
17
      This stylesheet is distributed in the hope that it will be useful,
18
      but WITHOUT ANY WARRANTY; without even the implied warranty of
19
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20
      Lesser General Public License for more details.
21
      
22
      You should have received a copy of GNU Lesser Public License with
23
      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
24
    </xd:detail>
25
    <xd:author>Serge Heiden slh@ens-lyon.fr</xd:author>
26
    <xd:copyright>2015, ENS de Lyon / UMR 5191 ICAR (Cactus)</xd:copyright>
27
  </xd:doc>
28

  
29
  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="yes" indent="yes"/>
30

  
31
  <xsl:template match="@*|node()">
32
    <xsl:copy>
33
      <xsl:apply-templates select="@*|node()"/>
34
    </xsl:copy>
35
  </xsl:template>
36
  
37
  <xsl:template match="ACT|SCENE">
38
   <xsl:copy>
39
		<xsl:attribute name="n">
40
			<xsl:number level="multiple" format="I.I" count="ACT|SCENE"/>
41
		</xsl:attribute>
42
    	<xsl:apply-templates select="@*|node()"/>
43
   </xsl:copy>
44
  </xsl:template>
45

  
46
  <xsl:template match="LINE">
47
   <xsl:copy>
48
		<xsl:attribute name="n">
49
			<xsl:number level="any" format="1" count="LINE" from="SCENE"/>
50
		</xsl:attribute>
51
    	<xsl:apply-templates select="@*|node()"/>
52
   </xsl:copy>
53
  </xsl:template>
54

  
55
</xsl:stylesheet>
56

  
0 57

  
tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-corpusakkadien-xmlw_syllabes-cuneiform.xsl (revision 1654)
85 85
  </xsl:analyze-string>
86 86
</xsl:template>-->
87 87
  
88
  <xsl:template match="text()[not(ancestor::*[local-name()='w']) and ancestor::*[local-name()='text']]">
89
  <txmOffText><xsl:value-of select="."/></txmOffText>
90
</xsl:template>
91
  
88 92
  <xsl:template match="*[local-name()='g']">
89 93
    <xsl:variable name="line"><xsl:value-of select="ancestor::*[local-name()='w']/@line"/></xsl:variable>
90 94
    <xsl:variable name="lemma"><xsl:value-of select="ancestor::*[local-name()='w']/@lemma"/></xsl:variable>
......
111 115
      <xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring(@refUnicode,4)"/></xsl:with-param></xsl:call-template>
112 116
    </xsl:variable>
113 117
    
114
    <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>
118
    <w line="{$line}" lemma="{$lemma}" pos="{$pos}" word-form="{$word-form}" supplied="{$supplied}" unclear="{$unclear}" ref-syllabaire="{@refSyllab}" ref-unicode="{@refUnicode}"><xsl:value-of select="."/></w>
115 119
    
116 120
  </xsl:template>
117 121

  
tmp/org.txm.core/res/org/txm/xml/xsl/txm-edition-xtz-cuneiform.xsl (revision 1654)
262 262
	                		<unicode>
263 263
	                			<xsl:choose>
264 264
	                				<xsl:when test="contains(following-sibling::txm:ana[@type='#ref-unicode'],'&amp;')">
265
	                					<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>
266
	                					<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>
265
	                					<xsl:for-each select="tokenize(substring(following-sibling::txm:ana[@type='#ref-unicode'],2),'&amp;')">
266
	                						<char><xsl:call-template name="hex2num"><xsl:with-param name="hex"><xsl:value-of select="substring-after(.,'U+')"/></xsl:with-param></xsl:call-template></char>
267
	                					</xsl:for-each>
268
<!--	                					<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>
269
	                					<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>-->
267 270
	                				</xsl:when>
268 271
	                				<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>
269 272
	                			</xsl:choose>
......
275 278
	                	
276 279
	                	<!--<xsl:value-of select="codepoints-to-string($unicode)"/>-->
277 280
	                	<xsl:for-each select="$unicode-chars/char">
278
	                		<xsl:value-of select="codepoints-to-string(.)"/>
281
	                		<xsl:choose>
282
	                			<!--<xsl:when test="number(.) = 74034">xxx</xsl:when>-->
283
	                			<xsl:when test="number(.) gt 50"><xsl:value-of select="codepoints-to-string(.)"/><!--[<xsl:value-of select="."/>]--></xsl:when>
284
	                			<xsl:otherwise>[?]</xsl:otherwise>
285
	                		</xsl:choose>
286
	                		
279 287
	                		<!--<xsl:value-of select="."/>-->
280 288
	                	</xsl:for-each>
281 289
                </xsl:template>
tmp/org.txm.core/res/org/txm/xml/xsl/txm-split-teicorpus.xsl (revision 1654)
1
<!-- The Identity Transformation -->
2
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
4
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
5

  
6
  <xd:doc type="stylesheet">
7
    <xd:short>
8
      This stylesheet is designed for TXM XTZ+CSV import module to split a
9
      single file containing a teiCorpus into individual files for each TEI
10
      child. This stylesheet should be used at "1-split-merge" step. See 
11
      TXM User Manual for more details 
12
      (http://textometrie.ens-lyon.fr/spip.php?rubrique64)
13
    </xd:short>
14
    <xd:detail>
15
      This stylesheet is free software; you can redistribute it and/or
16
      modify it under the terms of the GNU Lesser General Public
17
      License as published by the Free Software Foundation; either
18
      version 3 of the License, or (at your option) any later version.
19
      
20
      This stylesheet is distributed in the hope that it will be useful,
21
      but WITHOUT ANY WARRANTY; without even the implied warranty of
22
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23
      Lesser General Public License for more details.
24
      
25
      You should have received a copy of GNU Lesser Public License with
26
      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
27
    </xd:detail>
28
    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
29
    <xd:copyright>2017, CNRS / UMR 5317 IHRIM (CACTUS research group)</xd:copyright>
30
  </xd:doc>
31

  
32
<xsl:param name="output-directory">
33
  <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/.]+$">
34
    <xsl:matching-substring>
35
      <xsl:value-of select="regex-group(1)"/>
36
    </xsl:matching-substring>
37
  </xsl:analyze-string>
38
</xsl:param>
39

  
40
  <xsl:variable name="filename">
41
    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/.]+$">
42
      <xsl:matching-substring>
43
        <xsl:value-of select="regex-group(2)"/>
44
      </xsl:matching-substring>
45
    </xsl:analyze-string>
46
  </xsl:variable>
47

  
48
<xsl:template match="*:teiCorpus">
49
  <xsl:for-each select="descendant::*:TEI">
50
    <xsl:variable name="position" as="xs:integer">
51
      <xsl:number level="any"/>
52
    </xsl:variable>
53
    <xsl:variable name="result-filename">
54
      <xsl:choose>
55
        <xsl:when test="descendant::*:text[1]/@*:id">
56
          <xsl:value-of select="descendant::*:text[1]/@*:id"/>
57
        </xsl:when>
58
        <xsl:when test="@*:id">
59
          <xsl:value-of select="@*:id"/>
60
        </xsl:when>
61
        <xsl:otherwise>
62
          <xsl:value-of select="concat($filename,'-',format-number($position,'0000'))"/>
63
        </xsl:otherwise>
64
      </xsl:choose>
65
    </xsl:variable>
66
    <xsl:result-document href="{$output-directory}/{$result-filename}.xml">
67
      <xsl:copy-of select="."></xsl:copy-of>
68
    </xsl:result-document>
69
  </xsl:for-each>
70
</xsl:template>
71

  
72

  
73
</xsl:stylesheet>
0 74

  
tmp/org.txm.core/res/org/txm/xml/xsl/txm-posttok-unbreakWords.xsl (revision 1654)
2 2
<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
3 3
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
4 4
  xmlns:txm="http://textometrie.org/ns/1.0"
5
  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
5 6
  exclude-result-prefixes="tei edate" xpath-default-namespace="http://www.tei-c.org/ns/1.0" version="2.0">
6 7

  
7
  <!--
8
This software is dual-licensed:
9 8

  
10
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
11
Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
9
  <xd:doc type="stylesheet">
10
    <xd:short>
11
      This stylesheet is designed for TXM XTZ+CSV import module to re-unite 
12
      word tokens separated by lb, cb and pb tags bearing @break="no" 
13
      attribute. This stylesheet should be used at "3-posttok" step.
14
      All the tags separating the beginning and the end of a word must have 
15
      a @break='no' and their number must not exceed 3 in each case.
16
      See TXM User Manual for more details 
17
      (http://textometrie.ens-lyon.fr/spip.php?rubrique64)
18
    </xd:short>
19
    <xd:detail>
20
      This stylesheet is free software; you can redistribute it and/or
21
      modify it under the terms of the GNU Lesser General Public
22
      License as published by the Free Software Foundation; either
23
      version 3 of the License, or (at your option) any later version.
24
      
25
      This stylesheet is distributed in the hope that it will be useful,
26
      but WITHOUT ANY WARRANTY; without even the implied warranty of
27
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
28
      Lesser General Public License for more details.
29
      
30
      You should have received a copy of GNU Lesser Public License with
31
      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
32
    </xd:detail>
33
    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
34
    <xd:copyright>2017, CNRS / UMR 5317 IHRIM (CACTUS research group)</xd:copyright>
35
  </xd:doc>
36
       
12 37

  
13
2. http://www.opensource.org/licenses/BSD-2-Clause
14
		
15
All rights reserved.
16

  
17
Redistribution and use in source and binary forms, with or without
18
modification, are permitted provided that the following conditions are
19
met:
20

  
21
* Redistributions of source code must retain the above copyright
22
notice, this list of conditions and the following disclaimer.
23

  
24
* Redistributions in binary form must reproduce the above copyright
25
notice, this list of conditions and the following disclaimer in the
26
documentation and/or other materials provided with the distribution.
27

  
28
This software is provided by the copyright holders and contributors
29
"as is" and any express or implied warranties, including, but not
30
limited to, the implied warranties of merchantability and fitness for
31
a particular purpose are disclaimed. In no event shall the copyright
32
holder or contributors be liable for any direct, indirect, incidental,
33
special, exemplary, or consequential damages (including, but not
34
limited to, procurement of substitute goods or services; loss of use,
35
data, or profits; or business interruption) however caused and on any
36
theory of liability, whether in contract, strict liability, or tort
37
(including negligence or otherwise) arising in any way out of the use
38
of this software, even if advised of the possibility of such damage.
39

  
40
     
41
This stylesheet re-unites word tokens separated by lb, cb and pb tags
42
bearing @break="no" attribute. Can be used with TXM XTZ import module.
43

  
44
All the tags must have a @break='no' and their number must not exceed 3
45
in each case.
46

  
47
Written by Alexei Lavrentiev, UMR 5317 IHRIM, 2017
48
  -->
49

  
50

  
51 38
  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> 
52 39
  
53 40
  
tmp/org.txm.core/res/org/txm/xml/xsl/txm-split-xces-ids-corpus2text.xsl (revision 1654)
1
<?xml version="1.0" encoding="utf-8"?>
2

  
3
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
  xmlns:xd="http://www.pnp-software.com/XSLTdoc">
5
  
6
  <xd:doc type="stylesheet">
7
    <xd:short>
8
      This stylesheet transforms a single file of a XCES-IDS corpus into as 
9
      many files as separate texts for TXM XTZ import module
10
      For more details on source corpus encoding schema see 
11
      http://www1.ids-mannheim.de/kl/projekte/korpora/textmodell.html
12
    </xd:short>
13
    <xd:detail>
14
      This stylesheet is free software; you can redistribute it and/or
15
      modify it under the terms of the GNU Lesser General Public
16
      License as published by the Free Software Foundation; either
17
      version 3 of the License, or (at your option) any later version.
18
      
19
      This stylesheet is distributed in the hope that it will be useful,
20
      but WITHOUT ANY WARRANTY; without even the implied warranty of
21
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22
      Lesser General Public License for more details.
23
      
24
      You should have received a copy of GNU Lesser Public License with
25
      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
26
    </xd:detail>
27
    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
28
    <xd:copyright>2018, CNRS / UMR 5317 IHRIM (CACTUS research group)</xd:copyright>
29
  </xd:doc>
30
  
31
  <!-- Whenever you match any node or any attribute -->
32
  <xsl:template match="node()|@*">
33
    <!-- Copy the current node -->
34
    <xsl:copy>
35
      <!-- Including any attributes it has and any child nodes -->
36
      <xsl:apply-templates select="@*|node()"/>
37
    </xsl:copy>
38
  </xsl:template>
39
  
40
  <xsl:param name="output-directory">
41
    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/.]+$">
42
      <xsl:matching-substring>
43
        <xsl:value-of select="regex-group(1)"/>
44
      </xsl:matching-substring>
45
    </xsl:analyze-string>
46
  </xsl:param>
47
  
48
  <xsl:template match="/">
49
    <note>Empty output. The content is transferred into result-documents</note>
50
    <xsl:for-each select="descendant::idsText">
51
      <xsl:variable name="filename">
52
        <xsl:value-of select="substring-after(idsHeader//textSigle,'MK2')"/>
53
      </xsl:variable>
54
      <xsl:result-document href="{$output-directory}/{$filename}.xml">
55
        <TEI>
56
          <xsl:apply-templates/>
57
        </TEI>
58
      </xsl:result-document>
59
    </xsl:for-each>
60
  </xsl:template>
61
  
62
  
63
</xsl:stylesheet>
0 64

  
tmp/org.txm.core/res/org/txm/xml/xsl/2-default-pager.xsl (revision 1654)
2 2
<xsl:stylesheet exclude-result-prefixes="#all"
3 3
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 4
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
5
  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
5 6
  version="2.0">
6
  <!--
7
This software is dual-licensed:
7
    
8 8

  
9
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
10
Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
9
  <xd:doc type="stylesheet">
10
    <xd:short>
11
      This stylesheet is designed for TXM XTZ import module to create 
12
      HTML editions of corpus texts. This stylesheet should be used at 
13
      "4-edition" step and must be accompanied by 1-default-html.xsl. 
14
      See TXM User Manual for more details 
15
      (http://textometrie.ens-lyon.fr/spip.php?rubrique64)
16
    </xd:short>
17
    <xd:detail>
18
      This software is dual-licensed:
19
      
20
      1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
21
      Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
22
      
23
      2. http://www.opensource.org/licenses/BSD-2-Clause
24
      
25
      All rights reserved.
26
      
27
      Redistribution and use in source and binary forms, with or without
28
      modification, are permitted provided that the following conditions are
29
      met:
30
      
31
      * Redistributions of source code must retain the above copyright
32
      notice, this list of conditions and the following disclaimer.
33
      
34
      * Redistributions in binary form must reproduce the above copyright
35
      notice, this list of conditions and the following disclaimer in the
36
      documentation and/or other materials provided with the distribution.
37
      
38
      This software is provided by the copyright holders and contributors
39
      "as is" and any express or implied warranties, including, but not
40
      limited to, the implied warranties of merchantability and fitness for
41
      a particular purpose are disclaimed. In no event shall the copyright
42
      holder or contributors be liable for any direct, indirect, incidental,
43
      special, exemplary, or consequential damages (including, but not
44
      limited to, procurement of substitute goods or services; loss of use,
45
      data, or profits; or business interruption) however caused and on any
46
      theory of liability, whether in contract, strict liability, or tort
47
      (including negligence or otherwise) arising in any way out of the use
48
      of this software, even if advised of the possibility of such damage.
49
      
50
      $Id$
51
      
52
      This stylesheet is based on TEI processpb.xsl by Sebastian Rahtz 
53
      available at 
54
      https://github.com/TEIC/Stylesheets/blob/master/tools/processpb.xsl 
55
      
56
      and is adapted by Alexei Lavrentiev to split an HTML edition for 
57
      TXM platform.
58
    </xd:detail>
59
    <xd:author>Sebastian Rahtz and Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
60
    <xd:copyright>2017, CNRS / UMR 5317 IHRIM (CACTUS research group)</xd:copyright>
61
  </xd:doc>
11 62

  
12
2. http://www.opensource.org/licenses/BSD-2-Clause
13
		
14
All rights reserved.
63
  <!--
15 64

  
16
Redistribution and use in source and binary forms, with or without
17
modification, are permitted provided that the following conditions are
18
met:
19

  
20
* Redistributions of source code must retain the above copyright
21
notice, this list of conditions and the following disclaimer.
22

  
23
* Redistributions in binary form must reproduce the above copyright
24
notice, this list of conditions and the following disclaimer in the
25
documentation and/or other materials provided with the distribution.
26

  
27
This software is provided by the copyright holders and contributors
28
"as is" and any express or implied warranties, including, but not
29
limited to, the implied warranties of merchantability and fitness for
30
a particular purpose are disclaimed. In no event shall the copyright
31
holder or contributors be liable for any direct, indirect, incidental,
32
special, exemplary, or consequential damages (including, but not
33
limited to, procurement of substitute goods or services; loss of use,
34
data, or profits; or business interruption) however caused and on any
35
theory of liability, whether in contract, strict liability, or tort
36
(including negligence or otherwise) arising in any way out of the use
37
of this software, even if advised of the possibility of such damage.
38

  
39
     $Id$
40
     
41
This stylesheet is based on TEI processpb.xsl by Sebastian Rahtz 
42
available at 
43
https://github.com/TEIC/Stylesheets/blob/master/tools/processpb.xsl 
44
and is adapted by Alexei Lavrentiev to split an HTML edition for 
45
TXM platform.
46

  
47 65
  -->
48 66
  <xsl:output indent="no" method="html"/>
49 67
  
......
71 89
  </xsl:variable>
72 90
  
73 91
  <xsl:variable name="current-corpus-name">
74
    <xsl:analyze-string select="$current-file-directory" regex="^(.*)/([^/]+)$">
92
    <xsl:analyze-string select="$current-file-directory" regex="^(.*)/([^/]+)/[^/]+$">
75 93
      <xsl:matching-substring>
76 94
        <xsl:value-of select="regex-group(2)"/>
77 95
      </xsl:matching-substring>
tmp/org.txm.core/res/org/txm/xml/xsl/ts2xmlw.xsl (revision 1654)
82 82
  </xsl:template>
83 83

  
84 84
</xsl:stylesheet>
85

  
tmp/org.txm.core/res/org/txm/xml/xsl/txm-front-teiHeader2textAtt.xsl (revision 1654)
1 1
<?xml version="1.0"?>
2 2
<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
3 3
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
4
  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
4 5
  exclude-result-prefixes="tei edate" xpath-default-namespace="http://www.tei-c.org/ns/1.0" version="2.0">
5 6

  
6
  <!--
7
This software is dual-licensed:
7
  <xd:doc type="stylesheet">
8
    <xd:short>
9
      This stylesheet is designed for TXM XTZ+CSV import module to extract 
10
      metadata from the teiHeader and add them as attributes
11
      of the text element. It should be used at "2-front" step. See TXM 
12
      User Manual for more details 
13
      (http://textometrie.ens-lyon.fr/spip.php?rubrique64)
14
    </xd:short>
15
    <xd:detail>
16
      This stylesheet is free software; you can redistribute it and/or
17
      modify it under the terms of the GNU Lesser General Public
18
      License as published by the Free Software Foundation; either
19
      version 3 of the License, or (at your option) any later version.
20
      
21
      This stylesheet is distributed in the hope that it will be useful,
22
      but WITHOUT ANY WARRANTY; without even the implied warranty of
23
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24
      Lesser General Public License for more details.
25
      
26
      You should have received a copy of GNU Lesser Public License with
27
      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
28
    </xd:detail>
29
    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
30
    <xd:copyright>2017, CNRS / UMR 5317 IHRIM (CACTUS research group)</xd:copyright>
31
  </xd:doc>
8 32

  
9
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
10
Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
11 33

  
12
2. http://www.opensource.org/licenses/BSD-2-Clause
13
		
14
All rights reserved.
15 34

  
16
Redistribution and use in source and binary forms, with or without
17
modification, are permitted provided that the following conditions are
18
met:
19

  
20
* Redistributions of source code must retain the above copyright
21
notice, this list of conditions and the following disclaimer.
22

  
23
* Redistributions in binary form must reproduce the above copyright
24
notice, this list of conditions and the following disclaimer in the
25
documentation and/or other materials provided with the distribution.
26

  
27
This software is provided by the copyright holders and contributors
28
"as is" and any express or implied warranties, including, but not
29
limited to, the implied warranties of merchantability and fitness for
30
a particular purpose are disclaimed. In no event shall the copyright
31
holder or contributors be liable for any direct, indirect, incidental,
32
special, exemplary, or consequential damages (including, but not
33
limited to, procurement of substitute goods or services; loss of use,
34
data, or profits; or business interruption) however caused and on any
35
theory of liability, whether in contract, strict liability, or tort
36
(including negligence or otherwise) arising in any way out of the use
37
of this software, even if advised of the possibility of such damage.
38

  
39
     
40
This stylesheet extracts metadata from the teiHeader and adds them as attributes
41
of the text element. Can be used with TXM XTZ and XML/W import modules.
42

  
43
Written by Alexei Lavrentiev, UMR 5317 IHRIM, 2017
44
  -->
45

  
46

  
47 35
  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/> 
48 36
  
49 37
  
tmp/org.txm.core/res/org/txm/xml/xsl/txm-posttok-addRef.xsl (revision 1654)
50 50
  
51 51
  <!-- General patterns: all elements, attributes, comments and processing instructions are copied -->
52 52
  
53
  <xsl:variable name="filename">
54
    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.xml$">
55
      <xsl:matching-substring>
56
        <xsl:value-of select="regex-group(2)"/>
57
      </xsl:matching-substring>
58
    </xsl:analyze-string>
59
  </xsl:variable>
60
  
61
  
53 62
  <xsl:template match="*">      
54 63
        <xsl:copy>
55 64
          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
......
61 70
  <xsl:template match="@*|comment()|processing-instruction()">
62 71
    <xsl:copy/>
63 72
  </xsl:template>
64
  
73
    
65 74
  <xsl:template match="*:w">
66 75
    <xsl:variable name="ref">
67
      <xsl:if test="ancestor::*:text/@*:id"></xsl:if>
68
      <xsl:value-of select="ancestor::*:text[1]/@*:id[1]"/>
69
      <xsl:if test="ancestor::*:text/@*:id and preceding::*:pb[1]/@n">
70
        <xsl:text>, </xsl:text>
71
      </xsl:if>
76
      <xsl:choose>
77
        <xsl:when test="ancestor::*:text/@*:id">
78
          <xsl:value-of select="ancestor::*:text[1]/@*:id[1]"/>
79
        </xsl:when>
80
        <xsl:otherwise>
81
          <xsl:value-of select="$filename"/>
82
        </xsl:otherwise>
83
      </xsl:choose>
72 84
      <xsl:if test="preceding::*:pb[1]/@n">
73
        <xsl:text>p. </xsl:text>
85
        <xsl:text>, p. </xsl:text>
74 86
        <xsl:value-of select="preceding::*:pb[1]/@n"/>
75 87
      </xsl:if>
76 88
      <xsl:if test="(ancestor::*:text/@*:id or preceding::*:pb[1]/@n) and preceding::*:lb[1]/@n">
tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-bnc_oral-xmlw.xsl (revision 1654)
1
<?xml version="1.0"?>
2
<xsl:stylesheet
3
  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
4
  xmlns:edate="http://exslt.org/dates-and-times"
5
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
6
  exclude-result-prefixes="tei edate xd" version="2.0">
7
  
8
  <xd:doc type="stylesheet">
9
    <xd:short>
10
      Feuille de style de préparation de fichiers BNC oral à l'importation dans TXM
11
      (module XML/W+CSV).
12
    </xd:short>
13
    <xd:detail>
14
      This stylesheet is free software; you can redistribute it and/or
15
      modify it under the terms of the GNU Lesser General Public
16
      License as published by the Free Software Foundation; either
17
      version 3 of the License, or (at your option) any later version.
18
      
19
      This stylesheet is distributed in the hope that it will be useful,
20
      but WITHOUT ANY WARRANTY; without even the implied warranty of
21
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22
      Lesser General Public License for more details.
23
      
24
      You should have received a copy of GNU Lesser Public License with
25
      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
26
    </xd:detail>
27
    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
28
    <xd:copyright>2015, CNRS / ICAR (Cédilles-CACTUS)</xd:copyright>
29
  </xd:doc>
30
  
31

  
32
  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
33
  
34
	<!-- Listes des balises par type de traitement. -->
35
	
36
	<!--Par défaut, les balises sont conservées (les espaces de nommage sont
37
	respectés). On peut utiliser les paramètres ci-dessous pour indiquer les balises
38
	à supprimer en conservant ou non leur contenu--> 
39
	
40
	<!-- balises à supprimer avec leur contenu -->
41
	
42
	<xsl:param name="deleteAll">teiHeader</xsl:param>
43
	
44
	<xsl:template match="*[matches(name(),concat('^',$deleteAll,'$'))]"/>
45
	
46
	<!-- balises à supprimer en conservant le contenu-->
47
	
48
	<xsl:param name="deleteTag"></xsl:param>
49
	
50
	<xsl:template match="*[matches(name(),concat('^',$deleteTag,'$'))]">
51
		<xsl:apply-templates/>
52
	</xsl:template>
53
	
54
  
55
  <xsl:template match="*">
56
  	<xsl:copy>
57
  		<xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>	
58
  	</xsl:copy>
59
  </xsl:template>
60

  
61
  <xsl:template match="@*|comment()">
62
    <xsl:copy/>
63
  </xsl:template>
64
	
65
	<xsl:template match="processing-instruction()"/>
66
	
67
	<xsl:template match="text()"><xsl:value-of select="."/></xsl:template>
68

  
69
<xsl:template match="stext">
70
  <xsl:element name="text">
71
    <xsl:attribute name="type"><xsl:value-of select="@type"/></xsl:attribute>
72
    <xsl:attribute name="title"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/fileDesc/titleStmt/title[1])"/></xsl:attribute>
73
    <xsl:attribute name="creation"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/profileDesc/creation[1])"/></xsl:attribute>
74
    <xsl:attribute name="dlee"><xsl:value-of select="/bncDoc/teiHeader/profileDesc/textClass/classCode[@scheme='DLEE']"/></xsl:attribute>
75
    <xsl:choose>
76
      <xsl:when test="not(descendant::div[@decls])">
77
        
78
        <xsl:element name="div">
79
          <xsl:attribute name="placename"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/profileDesc/settingDesc/setting[1]/placeName[1])"/></xsl:attribute>
80
          <xsl:attribute name="locale"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/profileDesc/settingDesc/setting[1]/locale[1])"/></xsl:attribute>
81
          <xsl:attribute name="activity"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/profileDesc/settingDesc/setting[1]/activity[1])"/></xsl:attribute>
82
          <xsl:attribute name="activity-spont"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/profileDesc/settingDesc/setting[1]/activity[1]/@spont)"/></xsl:attribute>
83
          <xsl:attribute name="recordingdate"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/profileDesc/creation[1])"/></xsl:attribute>
84
          <xsl:attribute name="dlee"><xsl:value-of select="/bncDoc/teiHeader/profileDesc/textClass/classCode[@scheme='DLEE']"/></xsl:attribute>
85
          <xsl:apply-templates/>
86
        </xsl:element>
87
      </xsl:when>
88
      <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
89
    </xsl:choose>    
90
  </xsl:element>
91
</xsl:template>
92
  
93
  <xsl:template match="div[@decls]">
94
    <xsl:variable name="decls"><xsl:value-of select="@decls"/></xsl:variable>
95
    <xsl:copy>
96
      <xsl:apply-templates select="@*"/>
97
      <xsl:attribute name="placename"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/profileDesc/settingDesc/setting[matches($decls,@xml:id)]/placeName[1])"/></xsl:attribute>
98
      <xsl:attribute name="locale"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/profileDesc/settingDesc/setting[matches($decls,@xml:id)]/locale[1])"/></xsl:attribute>
99
      <xsl:attribute name="activity"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/profileDesc/settingDesc/setting[matches($decls,@xml:id)]/activity[1])"/></xsl:attribute>
100
      <xsl:attribute name="activity-spont"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/profileDesc/settingDesc/setting[1]/activity[1]/@spont)"/></xsl:attribute>
101
      
102
      <xsl:attribute name="recordingdate"><xsl:value-of select="normalize-space(/bncDoc/teiHeader/fileDesc/sourceDesc/recordingStmt/recording[matches($decls,@xml:id)]/@date)"/></xsl:attribute>
103
      <xsl:attribute name="dlee"><xsl:value-of select="/bncDoc/teiHeader/profileDesc/textClass/classCode[@scheme='DLEE']"/></xsl:attribute>
104
      <xsl:apply-templates/>
105
    </xsl:copy>
106
  </xsl:template>
107

  
108
	<xsl:template match="u">
109
	  <xsl:copy>
110
	    <xsl:variable name="who"><xsl:value-of select="@who"/></xsl:variable>
111
	    <xsl:attribute name="who"><xsl:value-of select="$who"/></xsl:attribute>
112
	    <xsl:for-each select="/bncDoc/teiHeader/profileDesc/particDesc/person[@xml:id=$who]/@*[not(local-name()='id')]">
113
	      <xsl:attribute name="{lower-case(local-name())}"><xsl:value-of select="."/></xsl:attribute>
114
	    </xsl:for-each>
115
	    <xsl:for-each select="/bncDoc/teiHeader/profileDesc/particDesc/person[@xml:id=$who]/*">
116
	      <xsl:attribute name="{lower-case(local-name())}"><xsl:value-of select="normalize-space(.)"/></xsl:attribute>
117
	    </xsl:for-each>
118
	    <xsl:apply-templates/>
119
	  </xsl:copy>
120
	</xsl:template>
121
	
122
	
123
	
124
</xsl:stylesheet>
0 125

  
tmp/org.txm.core/res/org/txm/xml/xsl/txm-posttok-structure2wordAtt.xsl (revision 1654)
1
<?xml version="1.0"?>
2
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
  xmlns:xd="http://www.pnp-software.com/XSLTdoc">
4
  
5
  <xd:doc type="stylesheet">
6
    <xd:short>
7
      This stylesheet projects the number of nesting selected ancestor 
8
      elements to attributes of the w element.
9
      Designed for 3-posttok step of the XTZ + CSV TXM import module.
10
      Enter element names separated by | as the value of 
11
      elementsToProject parameter.
12
    </xd:short>
13
    <xd:detail>
14
      This stylesheet is free software; you can redistribute it and/or
15
      modify it under the terms of the GNU Lesser General Public
16
      License as published by the Free Software Foundation; either
17
      version 3 of the License, or (at your option) any later version.
18
      
19
      This stylesheet is distributed in the hope that it will be useful,
20
      but WITHOUT ANY WARRANTY; without even the implied warranty of
21
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22
      Lesser General Public License for more details.
23
      
24
      You should have received a copy of GNU Lesser Public License with
25
      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
26
    </xd:detail>
27
    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
28
    <xd:copyright>2018, CNRS / UMR 5317 IHRIM (CACTUS research group)</xd:copyright>
29
  </xd:doc>
30
  
31
  <!-- List elements to count and project here -->
32
  <xsl:param name="elementsToProject">q|quote</xsl:param>
33
  
34
  <!-- Whenever you match any node or any attribute -->
35
  <xsl:template match="node()|@*">
36
    <!-- Copy the current node -->
37
    <xsl:copy>
38
      <!-- Including any attributes it has and any child nodes -->
39
      <xsl:apply-templates select="@*|node()"/>
40
    </xsl:copy>
41
  </xsl:template>
42
  
43
  <xsl:template match="*:w">
44
    <xsl:variable name="ancestors">
45
      <ancestors>
46
        <xsl:for-each select="ancestor::*">
47
          <xsl:copy/>
48
        </xsl:for-each>
49
      </ancestors>
50
    </xsl:variable>
51
    <xsl:copy>
52
      <xsl:apply-templates select="@*"/>
53
      <xsl:for-each select="tokenize($elementsToProject,'\|')">
54
        <xsl:variable name="elementName"><xsl:value-of select="."/></xsl:variable>
55
        <xsl:attribute name="{$elementName}">
56
          <xsl:choose>
57
            <xsl:when test="$ancestors//*[local-name(.)=$elementName]">
58
              <xsl:number value="count($ancestors//*[local-name()=$elementName])"></xsl:number>
59
            </xsl:when>
60
            <xsl:otherwise>0</xsl:otherwise>
61
          </xsl:choose>
62
        </xsl:attribute>
63
      </xsl:for-each>
64
      <xsl:apply-templates/>
65
    </xsl:copy>
66
  </xsl:template>
67
  
68
</xsl:stylesheet>
0 69

  
tmp/org.txm.core/res/org/txm/xml/xsl/txm-filter-teibvh-xmlw.xsl (revision 1654)
1
<?xml version="1.0"?>
2
<xsl:stylesheet xmlns:edate="http://exslt.org/dates-and-times"
3
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0"
4
  xmlns:xd="http://www.pnp-software.com/XSLTdoc"
5
  xmlns:txm="http://textometrie.org/1.0"
6
  exclude-result-prefixes="tei edate" version="2.0">
7

  
8
  <xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no"/>
9
  
10
  <xd:doc type="stylesheet">
11
    <xd:short>
12
      Cette feuille de style prépare les textes BVH à l'import BFM
13
    </xd:short>
14
    <xd:detail>
15
      This stylesheet is free software; you can redistribute it and/or
16
      modify it under the terms of the GNU Lesser General Public
17
      License as published by the Free Software Foundation; either
18
      version 3 of the License, or (at your option) any later version.
19
      
20
      This stylesheet is distributed in the hope that it will be useful,
21
      but WITHOUT ANY WARRANTY; without even the implied warranty of
22
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23
      Lesser General Public License for more details.
24
      
25
      You should have received a copy of GNU Lesser Public License with
26
      this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
27
    </xd:detail>
28
    <xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
29
    <xd:copyright>2012, CNRS / ICAR (ICAR3 LinCoBaTO)</xd:copyright>
30
  </xd:doc>
31
  
32
  
33
  <!-- !!! Enlever &#x2028 ou &#8232; dans 1600_BeroaldRich.xml !!! -->
34
  
35
  <!--
36
    Modifications par AL le  2012-01-25
37
    g dépalacé de "deleteAll" vers "deleteTag"
38
    classe de balise "name" créée
39
    (geogName, placeName, persName et name)
40
  -->
41
  
42
  <!-- 
43
    Modifications par LBe le 2012-02-17
44
    Transformation automatique des esperluettes dans les métadonnées
45
    Suppression des balises label et heraldry
46
    Signed n'est plus transformé en ab
47
    opener est transformé en ab
48
    L'institution et le dépôt sont récupérés pour le lieu de conservation
49
  -->
50
  
51
  <!-- Modifications par AL le 2012-02-20
52
    rolename -> roleName
53
    suppression des balises surname et forename
54
  -->
55
  
56
  <!-- Modifications par LBe le 2012-03-09
57
    Automatisation du nommage des sorties
58
  -->
59
  
60
  <!-- Modifications par LBe le 2013-03-05
61
    Ajout des nouveaux descripteurs pour Presto
62
  -->
63
  
64
  <!-- Modifications par LBe le 2014-01-10
65
    
66
  -->
67
  
68
<!-- Modifications par AL le 2014-01-13
69
    - Fusion des versions BVH et BFM
70
    - Détectioon des mots coupés (detextBrokenWord)
71
-->
72
  
73
  <!-- Listes des balises par type de traitement (les templates sont plus bas) -->
74
  
75
  <!-- balises à supprimer avec leur contenu -->
76
  <xsl:template match="tei:figDesc|tei:figure|tei:fw
77
    |tei:space">
78
    <xsl:call-template name="deleteAll"/>
79
  </xsl:template>
80
  
81
  <!-- balises à supprimer, contenu à conserver -->  
82
  <xsl:template match="tei:castItem|tei:castGroup[ancestor::tei:castList]
83
    |tei:castList[ancestor::tei:p]|tei:cell|tei:cit|tei:date
84
    |tei:forename|tei:g|tei:head[parent::tei:list]|tei:heraldry|tei:hi|tei:item|tei:label|tei:lem
85
    |tei:list[ancestor::tei:p|ancestor::tei:ab]|tei:lg[child::tei:lg|ancestor::tei:sp]
86
    |tei:p[ancestor::tei:sp]|tei:performance
87
    |tei:ref|tei:role|tei:roleDesc
88
    |tei:row|tei:salute|tei:signed[ancestor::tei:closer]|tei:speaker|tei:stage[ancestor::tei:p|ancestor::tei:ab]
89
    |tei:surname|tei:table[ancestor::tei:p]|tei:term|tei:unclear">
90
    <xsl:call-template name="deleteTag"/>
91
  </xsl:template>
92
  
93
  <!-- balises à transformer en notes-->
94
<!--  <xsl:template match="tei:bibl[not(ancestor::tei:note)]
95
    |tei:rdg[parent::tei:app and not(ancestor::tei:note)]">
96
    <xsl:call-template name="makeNote"/>
97
  </xsl:template>
98
-->  
99
  <!-- balises de noms à indexer -->
100
  
101
  <xsl:template match="tei:name
102
    |tei:geogName
103
    |tei:persName
104
    |tei:placeName
105
    |tei:roleName">
106
    <xsl:call-template name="makeName"/>
107
  </xsl:template>
108
  
109
  <!-- à transformer en W -->
110
  
111
  <xsl:template match="tei:abbr[not(parent::tei:choice)]
112
    |tei:num[matches(.,'.')]">
113
    <xsl:call-template name="makeWord"/>
114
  </xsl:template>
115
  
116
  <!-- à transformer en AB typé -->
117
  
118
  <xsl:template match="tei:byline|tei:lg[not(child::tei:lg or ancestor::tei:sp)]|tei:list[not(ancestor::tei:p|ancestor::tei:ab)]
119
    |tei:closer|tei:opener|tei:sp|tei:castGroup[not(ancestor::tei:castList)]|tei:castList[not(ancestor::tei:p)]
120
    |tei:signed[not(ancestor::tei:closer)]
121
    |tei:stage[not(ancestor::tei:p|ancestor::tei:ab)]
122
    |tei:table[not(ancestor::tei:p)]
123
    |tei:trailer">
124
    <xsl:call-template name="makeAb"/>
125
  </xsl:template>
126
  
127
  <!-- à transformer en DIV typé -->
128
  
129
  <xsl:template match="tei:set">
130
    <xsl:call-template name="makeDiv"/>
131
  </xsl:template>
132

  
133
<!-- Partie générale : on copie les éléments, les attributs, le texte, les commentaires, on supprime mes prrocessing intstructions -->
134
<!-- + nommage auto des fichiers -->
135
  
136
  <xsl:variable name="filedir">
137
    <xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)$">
138
      <xsl:matching-substring>
139
        <xsl:value-of select="regex-group(1)"></xsl:value-of>
140
      </xsl:matching-substring>
141
    </xsl:analyze-string></xsl:variable>
142
  
143
  
144
  <xsl:template match="/">
145
    <xsl:variable name="compare1" select="//tei:TEI/@xml:id"/>
146
    <!--<xsl:variable name="compare2" select="document('Nommage_Output_TXM.xml')//name/@id"/>-->
147
    <xsl:variable name="compare2" select="$nommage//name/@id"/>
148
    <xsl:variable name="name" select="document('Nommage_Output_TXM.xml')//name"/>
149
      <xsl:if test="$compare1 = $compare2">
150
    <xsl:result-document href="{concat($filedir,'/out/',$name[@id=$compare1], '.xml')}">
151
      <xsl:apply-templates/>  
152
    </xsl:result-document>
153
      </xsl:if>      
154
  </xsl:template>
155
  
156
  
157
  
158
  <xsl:template match="*">    
159
    <xsl:if test="descendant::tei:pb and (parent::tei:text or (position() &gt; 2))">
160
 <!-- on déplace les pb initiaux avant la balise de l'élément le plus haut -->
161
      <xsl:call-template name="raisePb"/>
162
    </xsl:if>
163
    <xsl:choose>
164
      <xsl:when test="namespace-uri()=''">
165
        <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}">
166
          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
167
        </xsl:element>
168
      </xsl:when>
169
      <xsl:otherwise>
170
        <xsl:copy>
171
          <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
172
        </xsl:copy>
173
      </xsl:otherwise>
174
    </xsl:choose>  
175
  </xsl:template>
176

  
177
  <xsl:template match="@*|comment()|text()|processing-instruction()">
178
    <xsl:copy/>
179
  </xsl:template>
180
	
181
	<xsl:template match="@instant[.='false']"></xsl:template>
182
	<xsl:template match="@status[.='unremarkable']"></xsl:template>
183

  
184
<!--  <xsl:template match="text()">
185
    <xsl:analyze-string select="." regex="&amp;">
186
      <xsl:matching-substring><expan xmlns="http://www.tei-c.org/ns/1.0">et</expan></xsl:matching-substring>
187
      <xsl:non-matching-substring>         
188
            <xsl:value-of select="."/>
189
      </xsl:non-matching-substring>      
190
    </xsl:analyze-string>
191
  </xsl:template>
192
  
193

  
194
  <xsl:template match="processing-instruction()"/>-->
195

  
196
<!-- On supprime teiHeader -->
197
  
198
  <xsl:template match="tei:teiHeader">    
199
<!--      <xsl:copy-of select="."/>-->    
200
  </xsl:template>
201

  
202
<!-- On supprime les balises et tout ce qu'elles contiennent pour les éléments hors texte à ignorer lors de l'import -->
203
  
204
  <xsl:template name="deleteAll"/>
205

  
206
<!-- On supprime les balises non essentielles pour l'exploitation textométrique et susceptibles de poser des problèmes au tokeniseur,
207
  mais on garde leur contenu qui fait partie du matériau textuel -->
208
  
209
  <xsl:template name="deleteTag">
210
    <xsl:apply-templates/>
211
  </xsl:template>
212

  
213
<!-- on met en note les éléments hors texte qu'on aimerait garder pour l'édition, etc. -->
214
  
215
<!--  <xsl:template name="makeNote">
216
    <note type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
217
      <xsl:value-of select="."/>
218
    </note>
219
  </xsl:template>
220
-->  
221
<!-- On supprime toutes les balises à l'intérieur des notes-->
222
<!--  <xsl:template match="tei:note">
223
    <xsl:copy>
224
      <xsl:value-of select="."></xsl:value-of>
225
    </xsl:copy>
226
  </xsl:template>-->
227

  
228
<!-- On transforme en DIV typés les balises de niveau de division textuelle (pouvant contenir des p) -->
229

  
230
  <xsl:template name="makeDiv">
231
    <div type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
232
      <xsl:copy-of select="@*"/>
233
      <xsl:apply-templates/>
234
    </div>
235
  </xsl:template>  
236

  
237
<!-- On transforme en bloc anonyme les balises de niveau équivalent au paragraphe -->
238

  
239
  <xsl:template name="makeAb">
240
    <ab type="{local-name()}" xmlns="http://www.tei-c.org/ns/1.0">
241
      <xsl:copy-of select="@*"/>
242
      <xsl:apply-templates/>
243
    </ab>
244
  </xsl:template>
245

  
246
  <!-- on pré-tokenise les éléments équivalents à un mot -->
247
  
248
  <xsl:template name="makeWord">
249
    <xsl:variable name="wordType">
250
      <xsl:choose>
251
        <xsl:when test="@type">
252
          <xsl:value-of select="concat(local-name(),'-',@type)"/>
253
        </xsl:when>
254
        <xsl:otherwise>
255
          <xsl:value-of select="local-name()"></xsl:value-of>
256
        </xsl:otherwise>
257
      </xsl:choose>
258
    </xsl:variable>
259
    <w type="{$wordType}" xmlns="http://www.tei-c.org/ns/1.0"><xsl:apply-templates/></w>
260
  </xsl:template>  
261

  
262
<xsl:template name="makeName">
263
  <xsl:variable name="nameType">
264
    <xsl:choose>
265
      <xsl:when test="@type">
266
        <xsl:value-of select="concat(local-name(),'-',@type)"/>
267
      </xsl:when>
268
      <xsl:otherwise>
269
        <xsl:value-of select="local-name()"></xsl:value-of>
270
      </xsl:otherwise>
271
    </xsl:choose>
272
  </xsl:variable>
273
  <name type="{$nameType}" xmlns="http://www.tei-c.org/ns/1.0">
274
    <xsl:apply-templates/>
275
  </name>
276
</xsl:template>
277

  
278
<!-- on avant l'élément au début duquel ils se situent -->
279

  
280
  <xsl:template name="raisePb">
281
    <xsl:if test="descendant::tei:pb">
282
      <xsl:for-each select="child::*[1][descendant-or-self::tei:pb]">
283
        <xsl:choose>
284
          <xsl:when test="self::tei:pb"><xsl:comment>Pb remonté</xsl:comment>
285
            <xsl:copy>
286
            	<xsl:apply-templates select="@*"/>
287
            	<xsl:if test="not(@n) and not(@facs) and following-sibling::tei:fw[1 or 2][@type='pageNum']">
288
            		<xsl:attribute name="n"><xsl:value-of select="normalize-space(following-sibling::tei:fw[@type='pageNum'][1])"/></xsl:attribute>
289
            	</xsl:if>
290
            </xsl:copy></xsl:when>
291
          <xsl:otherwise><xsl:call-template name="raisePb"></xsl:call-template></xsl:otherwise>
292
        </xsl:choose>
293
      </xsl:for-each>
294
    </xsl:if>
295
  </xsl:template>
296
  
297

  
298
<xsl:template match="tei:pb[not(preceding-sibling::*) and not(parent::tei:text)]">
299
  <xsl:comment>Pb déplacé plus haut</xsl:comment>
300
</xsl:template>
301

  
302
<xsl:template match="tei:pb[preceding-sibling::*]">
303
	<xsl:copy>
304
		<xsl:apply-templates select="@*"/>
305
		<xsl:if test="not(@n) and not(@facs) and following-sibling::tei:fw[1 or 2][@type='pageNum']">
306
			<xsl:attribute name="n"><xsl:value-of select="normalize-space(following-sibling::tei:fw[@type='pageNum'][1])"/></xsl:attribute>
307
		</xsl:if>
308
	</xsl:copy>
309
</xsl:template>
310

  
311
<!-- les l sont transformés en lb -->
312
  
313
  <xsl:template match="tei:l">
314
    <lb xmlns="http://www.tei-c.org/ns/1.0">
315
      <xsl:if test="@n">
316
        <xsl:attribute name="n"><xsl:value-of select="@n"/></xsl:attribute>
317
      </xsl:if>
318
    </lb>
319
    <xsl:apply-templates/>
320
  </xsl:template>
321
  
322

  
323
<!-- On met la ponctuation forte à l'extérieur de la balise foreign :
324
Cet élément sera toujours à l'intérieur d'une phrase. Attention au risque
325
de perdre les balises éventuelles à l'intérieur-->
326
  
327
  <xsl:template
328
    match="tei:foreign[matches(.,'[.!?]')]">
329
    <xsl:variable name="lang">
330
      <xsl:choose>
331
        <xsl:when test="@lang"><xsl:value-of select="@lang"/></xsl:when>
332
        <xsl:when test="@xml:lang"><xsl:value-of select="@xml:lang"/></xsl:when>
333
        <xsl:otherwise>xx</xsl:otherwise>
334
      </xsl:choose>
335
    </xsl:variable>
336
    <xsl:for-each select="child::node()">
337
      <xsl:choose>
338
        <xsl:when test="self::text()">
339
          <xsl:analyze-string select="." regex="([^.!?]*)([.?!]+)">
340
            <xsl:matching-substring>
341
              <foreign lang="{$lang}" xmlns="http://www.tei-c.org/ns/1.0">          
342
                <xsl:analyze-string select="regex-group(1)" regex="&amp;">
343
                  <xsl:matching-substring><expan xmlns="http://www.tei-c.org/ns/1.0">et</expan></xsl:matching-substring>
344
                  <xsl:non-matching-substring>         
345
                    <xsl:value-of select="."/>
346
                  </xsl:non-matching-substring>      
347
                </xsl:analyze-string>
348
              </foreign>
349
              <xsl:value-of select="regex-group(2)"/>
350
              <xsl:text> </xsl:text>
351
            </xsl:matching-substring>
352
          </xsl:analyze-string>          
353
        </xsl:when>
354
        <xsl:when test="self::*[not(descendant::text())]">
355
          <xsl:apply-templates/>
356
        </xsl:when>
357
        <xsl:otherwise>
358
          <foreign lang="{$lang}" xmlns="http://www.tei-c.org/ns/1.0">          
359
            <xsl:apply-templates select="."/>          
360
          </foreign>
361
        </xsl:otherwise>
362
      </xsl:choose>
363
    </xsl:for-each>
364
  </xsl:template>
365
  
366
  <!-- Injection des métadonnées -->
367
  
368
  <!-- copie de la template créée pour le header BVH -->
369
  
370
  <xsl:template match="tei:text">
371
    <xsl:variable name="auteur">
372
      <xsl:choose>
373
        <xsl:when test="//tei:monogr/tei:author[1]/tei:persName/tei:forename">
374
          <xsl:value-of select="//tei:monogr/tei:author[1]/tei:persName/tei:forename"/>&#160;<xsl:value-of select="//tei:monogr/tei:author[1]/tei:persName/tei:surname"/>
375
        </xsl:when>
376
        <xsl:when test="//tei:monogr/tei:author[1]/tei:persName">
377
          <xsl:value-of select="//tei:monogr/tei:author[1]/tei:persName"/>
378
        </xsl:when>
379
        <xsl:when test="//tei:monogr/tei:author">
380
          <xsl:value-of select="//tei:monogr/tei:author"/>
381
        </xsl:when>
382
        <xsl:otherwise>anonyme</xsl:otherwise>
383
      </xsl:choose>      
384
    </xsl:variable>
385
    <xsl:variable name="titre">
386
      <xsl:value-of select="translate(//tei:monogr/tei:title[@type='titre_court'],'&amp;', 'et')"/>
387
    </xsl:variable>    
388
    
389
        <text xmlns="http://www.tei-c.org/ns/1.0">
390
          <!-- id -->
391
             <xsl:variable name="compare1" select="//tei:TEI/@xml:id"/>
392
             <xsl:variable name="compare2" select="document('Nommage_Output_TXM.xml')//name/@id"/>
393
             <xsl:variable name="name" select="document('Nommage_Output_TXM.xml')//name"/>
394
      <xsl:if test="$compare1 = $compare2">        
395
          <xsl:attribute name="id">             
396
            <xsl:value-of select="$name[@id=$compare1]"/>
397
          </xsl:attribute>
398
      </xsl:if>
399
          <!-- sigle -->
400
             <xsl:variable name="compare1" select="//tei:TEI/@xml:id"/>
401
             <xsl:variable name="compare2" select="document('Nommage_Output_TXM.xml')//name/@id"/>
402
             <xsl:variable name="name" select="document('Nommage_Output_TXM.xml')//name"/>
403
      <xsl:if test="$compare1 = $compare2">        
404
          <xsl:attribute name="nom">             
405
            <xsl:value-of select="$name[@id=$compare1]"/>
406
          </xsl:attribute>
407
      </xsl:if>
408
          <!-- auteur -->
409
            <xsl:attribute name="auteur">
410
              <xsl:value-of select="$auteur"/>
411
            </xsl:attribute>
412
          <!-- titre -->
413
            <xsl:attribute name="titre">
414
                <xsl:value-of select="$titre"/>
415
            </xsl:attribute>
416
          <!-- date de composition -->
417
          <xsl:attribute name="date">
418
            <xsl:value-of select="//tei:monogr//tei:imprint/tei:date"/>
419
          </xsl:attribute>
420
          <!-- forme -->
421
            <xsl:attribute name="forme">
422
                <xsl:choose>
423
                    <xsl:when test="//tei:TEI[@xml:id='B360446201_B343_1_tei' 
424
                      or @xml:id='B360446201_B343_2_tei'
425
                      or @xml:id='B360446201_THIA63_1_tei.xml'
426
                      or @xml:id='B372615206_1263_tei'
427
                      or @xml:id='B372615206_3436_tei'
428
                      or @xml:id='B372615206_4023_tei'
429
                      or @xml:id='B372615206_4040_tei'
430
                      or @xml:id='B372616101_3537_tei'
431
                      or @xml:id='B410186201_I65_tei'
432
                      or @xml:id='B410186201_LI139_tei'
433
                      or @xml:id='B693836101_346632_tei'
434
                      or @xml:id='B693836101_A489170_tei'
435
                      or @xml:id='B751041006_FR_1513_tei'
436
                      or @xml:id='B751131010_FR3370_suppl_tei'
437
                      or @xml:id='B751131011_Y2_251_tei'
438
                      or @xml:id='B751131011_Y22789_tei'
439
                      or @xml:id='B751131015_X1888_tei'
440
                      or @xml:id='B751131015_Z1918_tei'
441
                      or @xml:id='B759999999_Y2_2162_tei'
442
                      or @xml:id='B759999999_Y2_2164_tei'
443
                      or @xml:id='B861946101_DP1139_tei'
444
                      or @xml:id='XUVA_Gordon1578_L47_tei']">
445
                        <xsl:text>Prose</xsl:text>
446
                    </xsl:when>
447
                    <xsl:otherwise>
448
                      <xsl:text>Vers</xsl:text>
449
                    </xsl:otherwise>
450
                </xsl:choose>
451
            </xsl:attribute>
452
          <!-- domaine -->
453
            <xsl:attribute name="domaine">
454
               <xsl:text>Littéraire</xsl:text>
455
            </xsl:attribute>
456
            <!-- genre -->
457
            <xsl:attribute name="genre">
458
            <xsl:text>|</xsl:text><xsl:value-of select="translate(@type, '_', ' ')"/><xsl:text>|</xsl:text><xsl:value-of select="translate(@subtype, '_', ' ')"/><xsl:text>|</xsl:text>
459
            </xsl:attribute> 
460
          <!-- nb mots -->
461
          <xsl:attribute name="mots"/>
462
            <!-- nb pages -->
463
            <xsl:attribute name="pages">
464
            <xsl:value-of select="count(//tei:pb)"/>
465
            </xsl:attribute>
466
          <!-- texte intégral -->
467
          <xsl:attribute name="integral">
468
            <xsl:text>Oui</xsl:text>
469
          </xsl:attribute>
470
          <!-- editeur scientifique -->
471
          <xsl:attribute name="edsci">
472
            <xsl:text>Marie-Luce Demonet</xsl:text>
473
          </xsl:attribute>
474
          <!-- maison d'édition -->
475
          <xsl:attribute name="edcomm">
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff