root / tmp / org.txm.oriflamms.rcp / bin / oriflamms-tokenize-chars-1-tag.xsl @ 476
History | View | Annotate | Download (21.5 kB)
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 xd txm" version="2.0"> |
7 |
|
8 |
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="no" indent="no"/> |
9 |
|
10 |
<xd:doc type="stylesheet"> |
11 |
<xd:short> |
12 |
Cette feuille permet de tokéniser un document TEI-Oriflamms au |
13 |
niveau de caractère. |
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>2015, CNRS / ICAR (Équipe CACTUS)</xd:copyright> |
31 |
</xd:doc> |
32 |
|
33 |
<!--<xsl:param name="spacing-am">ꝯ|⁊||∻|͛||᷑||ꝰ</xsl:param>--> |
34 |
<!-- on utilise la classe unicode 'combibning mark' \p{M} pour repérer les diacritiques --> |
35 |
|
36 |
|
37 |
<!-- <xsl:variable name="filename"> |
38 |
<xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$"> |
39 |
<xsl:matching-substring> |
40 |
<xsl:value-of select="regex-group(2)"/> |
41 |
</xsl:matching-substring> |
42 |
</xsl:analyze-string> |
43 |
</xsl:variable> |
44 |
|
45 |
<xsl:variable name="filedir"> |
46 |
<xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)\.[^/]+$"> |
47 |
<xsl:matching-substring> |
48 |
<xsl:value-of select="regex-group(1)"/> |
49 |
</xsl:matching-substring> |
50 |
</xsl:analyze-string> |
51 |
</xsl:variable> |
52 |
|
53 |
<xsl:variable name="filenameresult"> |
54 |
<xsl:value-of select="replace($filename,'(-ori)?-w$','')"/> |
55 |
</xsl:variable> |
56 |
|
57 |
|
58 |
<xsl:variable name="path"> |
59 |
<xsl:value-of select="concat($filedir,'/',$filenameresult,'-w/?select=*.xml;recurse=yes;on-error=warning')"/> |
60 |
</xsl:variable> |
61 |
|
62 |
<xsl:variable name="files" select="collection($path)"/> |
63 |
--> |
64 |
|
65 |
<!-- <xsl:template match="/"> |
66 |
<root>Processing files from <xsl:value-of select="$filedir/$filenameresult"/>-w directory. Result files saved in <xsl:value-of select="$filedir/$filenameresult"/>-c-temp directory.</root> |
67 |
<xsl:for-each select="$files"> |
68 |
<xsl:variable name="filename2"> |
69 |
<xsl:analyze-string select="document-uri(.)" regex="^(.*)/([^/]+)$"> |
70 |
<xsl:matching-substring> |
71 |
<xsl:value-of select="regex-group(2)"></xsl:value-of> |
72 |
</xsl:matching-substring> |
73 |
</xsl:analyze-string></xsl:variable> |
74 |
<xsl:result-document href="{$filedir}/{$filenameresult}-c-temp/{$filename2}"> |
75 |
<xsl:apply-templates/> |
76 |
</xsl:result-document> |
77 |
</xsl:for-each> |
78 |
</xsl:template> |
79 |
--> |
80 |
|
81 |
<xsl:param name="exclude-no-alignable">no</xsl:param> |
82 |
|
83 |
|
84 |
<xsl:template match="*"> |
85 |
<xsl:copy> |
86 |
<xsl:apply-templates select="@*"/> |
87 |
<xsl:apply-templates select="*|processing-instruction()|comment()|text()"/> |
88 |
</xsl:copy> |
89 |
</xsl:template> |
90 |
|
91 |
<xsl:template match="@*|comment()|processing-instruction()|text()"> |
92 |
<xsl:copy/> |
93 |
</xsl:template> |
94 |
|
95 |
<xsl:param name="editorialDeclPatch" as="element()"> |
96 |
<p xmlns="http://www.tei-c.org/ns/1.0">Fichier tokénisé au niveau des caractères dans le cadre du projet ANR Oriflamms (http://oriflamms.hypotheses.org) par le logiciel TXM (http://textometrie.ens-lyon.fr)</p> |
97 |
</xsl:param> |
98 |
|
99 |
<!-- Ob ajoute les infos sur le traitement du fichier dans teiHeader --> |
100 |
|
101 |
<xsl:template match="/*/tei:teiHeader"> |
102 |
<xsl:copy> |
103 |
<xsl:apply-templates select="@*"/> |
104 |
<xsl:choose> |
105 |
<xsl:when test="child::tei:encodingDesc"> |
106 |
<xsl:apply-templates/> |
107 |
</xsl:when> |
108 |
<xsl:otherwise> |
109 |
<xsl:apply-templates select="tei:fileDesc|tei:profileDesc"/> |
110 |
<encodingDesc xmlns="http://www.tei-c.org/ns/1.0"> |
111 |
<editorialDecl xmlns="http://www.tei-c.org/ns/1.0"> |
112 |
<xsl:copy-of select="$editorialDeclPatch"></xsl:copy-of> |
113 |
</editorialDecl> |
114 |
</encodingDesc> |
115 |
<xsl:choose> |
116 |
<xsl:when test="not(tei:revisionDesc)"> |
117 |
<revisionDesc xmlns="http://www.tei-c.org/ns/1.0"> |
118 |
<xsl:call-template name="change-txm"></xsl:call-template> |
119 |
</revisionDesc> |
120 |
</xsl:when> |
121 |
<xsl:otherwise> |
122 |
<xsl:apply-templates select="tei:revisionDesc"/> |
123 |
</xsl:otherwise> |
124 |
</xsl:choose> |
125 |
</xsl:otherwise> |
126 |
</xsl:choose> |
127 |
</xsl:copy> |
128 |
</xsl:template> |
129 |
|
130 |
<xsl:template match="/*/tei:teiHeader/tei:fileDesc/tei:titleStmt"> |
131 |
<xsl:copy> |
132 |
<xsl:apply-templates select="@*|node()"/> |
133 |
<xsl:if test="not(tei:respStmt/tei:name[@xml:id='TXM'])"> |
134 |
<respStmt xmlns="http://www.tei-c.org/ns/1.0"> |
135 |
<resp xmlns="http://www.tei-c.org/ns/1.0">Tokénisation des mots et/ou des caractères</resp> |
136 |
<name xmlns="http://www.tei-c.org/ns/1.0" xml:id="TXM">Logiciel TXM (http://textometrie.ens-lyon.fr)</name> |
137 |
</respStmt> |
138 |
</xsl:if> |
139 |
</xsl:copy> |
140 |
</xsl:template> |
141 |
|
142 |
<xsl:template match="/*/tei:teiHeader/tei:encodingDesc"> |
143 |
<xsl:copy> |
144 |
<xsl:apply-templates select="@*"/> |
145 |
<xsl:choose> |
146 |
<xsl:when test="child::tei:editorialDecl"> |
147 |
<xsl:apply-templates/> |
148 |
</xsl:when> |
149 |
<xsl:otherwise> |
150 |
<xsl:apply-templates/> |
151 |
<editorialDecl xmlns="http://www.tei-c.org/ns/1.0"> |
152 |
<xsl:copy-of select="$editorialDeclPatch"></xsl:copy-of> |
153 |
</editorialDecl> |
154 |
</xsl:otherwise> |
155 |
</xsl:choose> |
156 |
</xsl:copy> |
157 |
</xsl:template> |
158 |
|
159 |
<xsl:template match="tei:editorialDecl"> |
160 |
<xsl:copy> |
161 |
<xsl:apply-templates select="@*"/> |
162 |
<xsl:apply-templates/> |
163 |
<xsl:copy-of select="$editorialDeclPatch"></xsl:copy-of> |
164 |
</xsl:copy> |
165 |
</xsl:template> |
166 |
|
167 |
<xsl:template match="/*/tei:teiHeader//tei:revisionDesc"> |
168 |
<xsl:copy> |
169 |
<xsl:apply-templates select="@*|node()"/> |
170 |
<xsl:call-template name="change-txm"/> |
171 |
</xsl:copy> |
172 |
</xsl:template> |
173 |
|
174 |
<xsl:template name="change-txm"> |
175 |
<change when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" who="#TXM" xmlns="http://www.tei-c.org/ns/1.0">Tokenisation des caractères</change> |
176 |
</xsl:template> |
177 |
|
178 |
|
179 |
|
180 |
<xsl:template match="tei:supplied"> |
181 |
<gap reason="supplied" xmlns="http://www.tei-c.org/ns/1.0"><xsl:comment><xsl:copy-of select="."></xsl:copy-of></xsl:comment></gap> |
182 |
</xsl:template> |
183 |
|
184 |
<xsl:template match="tei:w|tei:pc|tei:seg[@type='wp']|tei:seg[@type='deleted']"> |
185 |
<xsl:copy> |
186 |
<xsl:apply-templates select="@*"/> |
187 |
<xsl:for-each select="child::node()"> |
188 |
<xsl:choose> |
189 |
<xsl:when test="self::tei:choice and $exclude-no-alignable='yes'"> |
190 |
<xsl:apply-templates select="tei:abbr|tei:orig|tei:sic"/> |
191 |
</xsl:when> |
192 |
<xsl:when test="self::text()"> |
193 |
<xsl:if test="matches(.,'\S') and not(ancestor::*[@ana='ori:align-no'])"><xsl:call-template name="tokenise-chars"/></xsl:if> |
194 |
</xsl:when> |
195 |
<xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise> |
196 |
</xsl:choose> |
197 |
</xsl:for-each> |
198 |
</xsl:copy> |
199 |
</xsl:template> |
200 |
|
201 |
<xsl:template match="tei:orig|tei:sic"> |
202 |
<xsl:copy> |
203 |
<xsl:apply-templates select="@*"/> |
204 |
<xsl:choose> |
205 |
<xsl:when test="ancestor::tei:w|ancestor::tei:pc"> |
206 |
<xsl:for-each select="child::node()"> |
207 |
<xsl:choose> |
208 |
<xsl:when test="self::text() and not(ancestor::*[@ana='ori:align-no'])"> |
209 |
<xsl:if test="matches(.,'\S')"><xsl:call-template name="tokenise-chars"/></xsl:if> |
210 |
</xsl:when> |
211 |
<xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise> |
212 |
</xsl:choose> |
213 |
</xsl:for-each> |
214 |
</xsl:when> |
215 |
<xsl:otherwise><xsl:apply-templates/></xsl:otherwise> |
216 |
</xsl:choose> |
217 |
</xsl:copy> |
218 |
</xsl:template> |
219 |
|
220 |
|
221 |
<xsl:template match="tei:abbr"> |
222 |
<xsl:choose> |
223 |
<xsl:when test="matches(.,'\P{M}')"> |
224 |
<xsl:copy> |
225 |
<xsl:apply-templates select="@*"/> |
226 |
<xsl:choose> |
227 |
<xsl:when test="ancestor::tei:w"> |
228 |
<xsl:for-each select="child::node()"> |
229 |
<xsl:choose> |
230 |
<xsl:when test="self::text()"> |
231 |
<xsl:if test="matches(.,'\S') and not(ancestor::*[@ana='ori:align-no'])"><xsl:call-template name="tokenise-chars"/></xsl:if> |
232 |
</xsl:when> |
233 |
<xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise> |
234 |
</xsl:choose> |
235 |
</xsl:for-each> |
236 |
</xsl:when> |
237 |
<xsl:otherwise><xsl:apply-templates/></xsl:otherwise> |
238 |
</xsl:choose> |
239 |
</xsl:copy> |
240 |
</xsl:when> |
241 |
<xsl:otherwise><!-- on supprime les abréviations consistant uniquement de caractères modifieurs --></xsl:otherwise> |
242 |
</xsl:choose> |
243 |
</xsl:template> |
244 |
|
245 |
|
246 |
<xsl:template match="tei:g"> |
247 |
<xsl:choose> |
248 |
<xsl:when test="ancestor::*[@ana='ori:align-no']"> |
249 |
<xsl:copy-of select="."/> |
250 |
</xsl:when> |
251 |
<xsl:otherwise> |
252 |
<c xmlns="http://www.tei-c.org/ns/1.0"> |
253 |
<xsl:if test="matches(@type,'initiale?|lettrine')"> |
254 |
<xsl:attribute name="type">initiale</xsl:attribute> |
255 |
</xsl:if> |
256 |
<xsl:copy-of select="."/> |
257 |
</c> |
258 |
</xsl:otherwise> |
259 |
</xsl:choose> |
260 |
</xsl:template> |
261 |
|
262 |
<xsl:template match="tei:c"> |
263 |
<xsl:choose> |
264 |
<xsl:when test="ancestor::*[@ana='ori:align-no'] or ancestor::tei:expan[parent::tei:choice]"> |
265 |
<xsl:copy-of select="child::node()"/> |
266 |
</xsl:when> |
267 |
<xsl:otherwise> |
268 |
<xsl:copy-of select="."></xsl:copy-of> |
269 |
</xsl:otherwise> |
270 |
</xsl:choose> |
271 |
</xsl:template> |
272 |
|
273 |
<xsl:template match="tei:am"> |
274 |
<xsl:choose> |
275 |
<xsl:when test="matches(.,'\P{M}')"> |
276 |
<!-- \p{M} est la classe unicode de caractères combinants => \P{M} = tout sauf combinant --> |
277 |
<c xmlns="http://www.tei-c.org/ns/1.0" type="am"> |
278 |
<xsl:apply-templates select="@*"/> |
279 |
<xsl:apply-templates/> |
280 |
</c> |
281 |
</xsl:when> |
282 |
</xsl:choose> |
283 |
</xsl:template> |
284 |
|
285 |
|
286 |
<xsl:template match="*[@ana='ori:align-no']"> |
287 |
<xsl:choose> |
288 |
<xsl:when test="$exclude-no-alignable='yes'"> |
289 |
<xsl:comment><xsl:value-of select="."/></xsl:comment> |
290 |
</xsl:when> |
291 |
<xsl:otherwise> |
292 |
<!--<xsl:copy-of select="."/>--> |
293 |
<xsl:copy> |
294 |
<xsl:apply-templates select="@*|node()"/> |
295 |
</xsl:copy> |
296 |
</xsl:otherwise> |
297 |
</xsl:choose> |
298 |
</xsl:template> |
299 |
|
300 |
<xsl:template match="tei:ex[not(ancestor-or-self::*[@ana='ori:align-no']) and not(parent::tei:expan/parent::tei:choice/tei:abbr)]"> |
301 |
<xsl:choose> |
302 |
<xsl:when test="$exclude-no-alignable='yes'"> |
303 |
<xsl:choose> |
304 |
<xsl:when test="matches(.,'^(et|cum|co[mn]|est|ur|us)$','i')"> |
305 |
<c xmlns="http://www.tei-c.org/ns/1.0"><g xmlns="http://www.tei-c.org/ns/1.0" type="am"><xsl:call-template name="abbreviate"/></g></c> |
306 |
</xsl:when> |
307 |
<xsl:otherwise><xsl:comment><xsl:copy-of select="."/></xsl:comment></xsl:otherwise> |
308 |
</xsl:choose> |
309 |
</xsl:when> |
310 |
<xsl:otherwise> |
311 |
<choice xmlns="http://www.tei-c.org/ns/1.0"> |
312 |
<abbr xmlns="http://www.tei-c.org/ns/1.0"> |
313 |
<xsl:choose> |
314 |
<xsl:when test="matches(.,'^(et|cum|co[mn]|est|ur|us)$','i')"> |
315 |
<c xmlns="http://www.tei-c.org/ns/1.0"><g xmlns="http://www.tei-c.org/ns/1.0" type="am"><xsl:call-template name="abbreviate"/></g></c> |
316 |
</xsl:when> |
317 |
<xsl:otherwise/> |
318 |
</xsl:choose> |
319 |
</abbr> |
320 |
<expan xmlns="http://www.tei-c.org/ns/1.0"> |
321 |
<xsl:copy-of select="."/> |
322 |
</expan> |
323 |
</choice> |
324 |
</xsl:otherwise> |
325 |
</xsl:choose> |
326 |
</xsl:template> |
327 |
|
328 |
<xsl:template name="abbreviate"> |
329 |
<xsl:choose> |
330 |
<xsl:when test="matches(.,'^(cum|com|con)$','i')">ꝯ</xsl:when> |
331 |
<xsl:when test="matches(.,'^et$','i')">⁊</xsl:when> |
332 |
<xsl:when test="matches(.,'^est$','i')">∻</xsl:when> |
333 |
<xsl:when test="matches(.,'^us$','i')">ꝰ</xsl:when> |
334 |
<xsl:otherwise>¤</xsl:otherwise> |
335 |
</xsl:choose> |
336 |
</xsl:template> |
337 |
|
338 |
<!--<xsl:template match="tei:ex[parent::tei:expan/parent::tei:choice/tei:abbr and not(ancestor-or-self::*[@ana='ori:align-no'])]"> |
339 |
<xsl:copy-of select="."/> |
340 |
</xsl:template>--> |
341 |
|
342 |
<xsl:template match="tei:expan[parent::tei:choice/tei:abbr and not(ancestor-or-self::*[@ana='ori:align-no'])]"> |
343 |
<xsl:copy-of select="."/> |
344 |
</xsl:template> |
345 |
|
346 |
|
347 |
<xsl:template match="tei:w//tei:hi[matches(@rend,'suscrit|enclavé')]"> |
348 |
<!-- les lettres suscrites et enclavées sont regroupées avec le caractère précédent --> |
349 |
</xsl:template> |
350 |
|
351 |
<xsl:template match="tei:w//tei:hi[matches(@rend,'ligature|fusionnées')]"> |
352 |
<xsl:choose> |
353 |
<xsl:when test="descendant::*"> |
354 |
<xsl:copy> |
355 |
<xsl:apply-templates select="@*"/> |
356 |
<xsl:for-each select="child::node()"> |
357 |
<xsl:choose> |
358 |
<xsl:when test="self::text()"> |
359 |
<xsl:if test="matches(.,'\S') and not(ancestor::*[@ana='ori:align-no'])"><xsl:call-template name="tokenise-chars"/></xsl:if> |
360 |
</xsl:when> |
361 |
<xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise> |
362 |
</xsl:choose> |
363 |
</xsl:for-each> |
364 |
</xsl:copy> |
365 |
</xsl:when> |
366 |
<xsl:otherwise><c xmlns="http://www.tei-c.org/ns/1.0"><g xmlns="http://www.tei-c.org/ns/1.0" type="{@rend}"><xsl:apply-templates/></g></c></xsl:otherwise> |
367 |
</xsl:choose> |
368 |
</xsl:template> |
369 |
|
370 |
<xsl:template match="tei:w//tei:hi[matches(@rend,'lettre majuscule')]"> |
371 |
<c xmlns="http://www.tei-c.org/ns/1.0"><g xmlns="http://www.tei-c.org/ns/1.0" type="{replace(@rend,' ','_')}"><xsl:apply-templates/></g></c> |
372 |
</xsl:template> |
373 |
|
374 |
<xsl:template match="tei:w//tei:hi[matches(@rend,'initiale?|lettrine')]"> |
375 |
<xsl:choose> |
376 |
<xsl:when test="tei:choice/tei:abbr and tei:choice/tei:expan"> |
377 |
<choice xmlns="http://www.tei-c.org/ns/1.0"> |
378 |
<abbr xmlns="http://www.tei-c.org/ns/1.0"> |
379 |
<c type="initiale" xmlns="http://www.tei-c.org/ns/1.0"><g xmlns="http://www.tei-c.org/ns/1.0" type="initiale"><xsl:value-of select="tei:choice/tei:abbr"/></g></c> |
380 |
</abbr> |
381 |
<xsl:copy-of select="descendant::tei:expan"/> |
382 |
</choice> |
383 |
</xsl:when> |
384 |
<xsl:otherwise> |
385 |
<c type="initiale" xmlns="http://www.tei-c.org/ns/1.0"><g xmlns="http://www.tei-c.org/ns/1.0" type="initiale"><xsl:apply-templates/></g></c> |
386 |
</xsl:otherwise> |
387 |
</xsl:choose> |
388 |
</xsl:template> |
389 |
|
390 |
<xsl:template match="tei:w//tei:hi[matches(@rend,'lettres allongées|red|sup|highlight')]"> |
391 |
<xsl:copy> |
392 |
<xsl:apply-templates select="@*"/> |
393 |
<xsl:attribute name="rend"><xsl:value-of select="replace(@rend,' ','_')"/></xsl:attribute> |
394 |
<xsl:for-each select="child::node()"> |
395 |
<xsl:choose> |
396 |
<xsl:when test="self::text()"> |
397 |
<xsl:if test="matches(.,'\S') and not(ancestor::*[@ana='ori:align-no'])"><xsl:call-template name="tokenise-chars"/></xsl:if> |
398 |
</xsl:when> |
399 |
<xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise> |
400 |
</xsl:choose> |
401 |
</xsl:for-each> |
402 |
</xsl:copy> |
403 |
</xsl:template> |
404 |
|
405 |
<xsl:template match="*[ancestor::tei:w and not(ancestor-or-self::*[@ana='ori:align-no'])]" priority="-0.1"> |
406 |
<xsl:copy> |
407 |
<xsl:apply-templates select="@*"/> |
408 |
<xsl:for-each select="child::node()"> |
409 |
<xsl:choose> |
410 |
<xsl:when test="self::tei:choice and $exclude-no-alignable='yes'"> |
411 |
<xsl:apply-templates select="tei:abbr|tei:orig|tei:sic"/> |
412 |
</xsl:when> |
413 |
<xsl:when test="self::text()"> |
414 |
<xsl:if test="matches(.,'\S')"><xsl:call-template name="tokenise-chars"/></xsl:if> |
415 |
</xsl:when> |
416 |
<xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise> |
417 |
</xsl:choose> |
418 |
</xsl:for-each> |
419 |
</xsl:copy> |
420 |
</xsl:template> |
421 |
|
422 |
<xsl:template match="tei:choice[ancestor::tei:w and matches(tei:abbr,'^\p{M}+$')]" priority="1"> |
423 |
<xsl:comment>abréviation déplacée : <xsl:copy-of select="."/></xsl:comment> |
424 |
</xsl:template> |
425 |
|
426 |
<xsl:template name="tokenise-chars"> |
427 |
|
428 |
<xsl:variable name="following-am"> |
429 |
<xsl:if test="following-sibling::node()[1][self::tei:abbr] and not(matches(following-sibling::node()[1][self::tei:abbr],'\P{M}'))"> |
430 |
<g xmlns="http://www.tei-c.org/ns/1.0" type="am"><xsl:value-of select="following-sibling::tei:abbr[1]"/></g> |
431 |
</xsl:if> |
432 |
<xsl:if test="following-sibling::node()[1][self::tei:choice[tei:abbr]] and not(matches(following-sibling::node()[1][self::tei:choice]/tei:abbr[1],'\P{M}'))"> |
433 |
<g xmlns="http://www.tei-c.org/ns/1.0" type="am"><xsl:value-of select="following::tei:abbr[1]"/></g> |
434 |
</xsl:if> |
435 |
<xsl:if test="following-sibling::node()[1][self::tei:am] and not(matches(following-sibling::node()[1][self::tei:am],'\P{M}'))"> |
436 |
<g xmlns="http://www.tei-c.org/ns/1.0" type="am"><xsl:value-of select="following-sibling::tei:am[1]"/></g> |
437 |
</xsl:if> |
438 |
<xsl:if test="following-sibling::node()[1][self::tei:hi[@rend='suscrit']]"> |
439 |
<g xmlns="http://www.tei-c.org/ns/1.0" type="suscrit"><xsl:value-of select="following-sibling::tei:hi[1]"/></g> |
440 |
</xsl:if> |
441 |
<xsl:if test="following-sibling::node()[1][self::tei:hi[@rend='enclavé']]"> |
442 |
<g xmlns="http://www.tei-c.org/ns/1.0" type="enclavé"><xsl:value-of select="following-sibling::tei:hi[1]"/></g> |
443 |
</xsl:if> |
444 |
</xsl:variable> |
445 |
|
446 |
<xsl:variable name="following-expan"> |
447 |
<xsl:if test="following-sibling::node()[1][self::tei:choice[tei:expan]] and not(matches(following-sibling::node()[1][self::tei:choice]/tei:abbr[1],'\P{M}')) and not($exclude-no-alignable='yes')"> |
448 |
<expan xmlns="http://www.tei-c.org/ns/1.0"> |
449 |
<xsl:value-of select="substring(.,string-length(.))"/> |
450 |
<xsl:apply-templates select="following-sibling::tei:choice[1]/tei:expan[1]/node()"/> |
451 |
</expan> |
452 |
</xsl:if> |
453 |
</xsl:variable> |
454 |
|
455 |
<xsl:choose> |
456 |
<xsl:when test="ancestor::*[@ana='ori:align-no'] |
457 |
or ancestor::tei:expan[parent::tei:choice] |
458 |
or ancestor::tei:corr[parent::tei:choice] |
459 |
or ancestor::tei:reg[parent::tei:choice]"> |
460 |
<xsl:copy-of select="."/> |
461 |
</xsl:when> |
462 |
<xsl:otherwise> |
463 |
<xsl:analyze-string select="." regex="^(.*)(\P{{M}})(\p{{M}}*)"> |
464 |
<xsl:matching-substring> |
465 |
<xsl:variable name="chars"><xsl:value-of select="replace(regex-group(1),'[''’]','')"/></xsl:variable> |
466 |
<xsl:variable name="last-char"><xsl:value-of select="replace(regex-group(2),'[''’]','')"/></xsl:variable> |
467 |
<xsl:variable name="last-comb-mark"><xsl:value-of select="regex-group(3)"/></xsl:variable> |
468 |
<xsl:analyze-string select="$chars" regex="(\P{{M}})(\p{{M}}*)"> |
469 |
<xsl:matching-substring> |
470 |
<c xmlns="http://www.tei-c.org/ns/1.0"> |
471 |
<xsl:value-of select="regex-group(1)"/> |
472 |
<xsl:if test="matches(regex-group(2),'.+')"> |
473 |
<g xmlns="http://www.tei-c.org/ns/1.0" type="am"><xsl:value-of select="regex-group(2)"/></g> |
474 |
</xsl:if> |
475 |
</c> |
476 |
</xsl:matching-substring> |
477 |
</xsl:analyze-string> |
478 |
<xsl:if test="matches($last-char,'.+')"> |
479 |
<xsl:choose> |
480 |
<xsl:when test="matches($following-expan,'.+')"> |
481 |
<choice xmlns="http://www.tei-c.org/ns/1.0"> |
482 |
<abbr xmlns="http://www.tei-c.org/ns/1.0"> |
483 |
<c xmlns="http://www.tei-c.org/ns/1.0"> |
484 |
<xsl:value-of select="$last-char"/> |
485 |
<xsl:if test="matches($last-comb-mark,'.+')"> |
486 |
<g xmlns="http://www.tei-c.org/ns/1.0" type="am"><xsl:value-of select="$last-comb-mark"/></g> |
487 |
</xsl:if> |
488 |
<xsl:copy-of select="$following-am"/> |
489 |
</c> |
490 |
</abbr> |
491 |
<xsl:copy-of select="$following-expan"/> |
492 |
</choice> |
493 |
</xsl:when> |
494 |
<xsl:otherwise> |
495 |
<c xmlns="http://www.tei-c.org/ns/1.0"> |
496 |
<xsl:value-of select="$last-char"/> |
497 |
<xsl:if test="matches($last-comb-mark,'.+')"> |
498 |
<g xmlns="http://www.tei-c.org/ns/1.0" type="am"><xsl:value-of select="$last-comb-mark"/></g> |
499 |
</xsl:if> |
500 |
<xsl:copy-of select="$following-am"/> |
501 |
</c> |
502 |
</xsl:otherwise> |
503 |
</xsl:choose> |
504 |
</xsl:if> |
505 |
</xsl:matching-substring> |
506 |
</xsl:analyze-string> |
507 |
</xsl:otherwise> |
508 |
</xsl:choose> |
509 |
|
510 |
</xsl:template> |
511 |
|
512 |
|
513 |
</xsl:stylesheet> |