Statistics
| Revision:

root / tmp / org.txm.oriflamms.rcp / groovy / org / txm / macro / oriflamms / prepare / oriflamms-convert-graalc-oriflammsxml.xsl @ 2398

History | View | Annotate | Download (21 kB)

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

    
10
	<xsl:output method="xml" encoding="utf-8"
11
		omit-xml-declaration="no" indent="no" />
12

    
13
	<xd:doc type="stylesheet">
14
		<xd:short>
15
			Cette feuille permet de convertir la transcription compacte de la
16
			Queste del saint Graal au format XML-TEI du projet Oriflamms.
17
		</xd:short>
18
		<xd:detail>
19
			This stylesheet is free software; you can redistribute it and/or
20
			modify it under the terms of the GNU Lesser General Public
21
			License as published by the Free Software Foundation; either
22
			version 3 of the License, or (at your option) any later version.
23

    
24
			This stylesheet is distributed in the hope that it will be useful,
25
			but WITHOUT ANY WARRANTY; without even the implied warranty of
26
			MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27
			Lesser General Public License for more details.
28

    
29
			You should have received a copy of GNU Lesser Public License with
30
			this stylesheet. If not, see http://www.gnu.org/licenses/lgpl.html
31
		</xd:detail>
32
		<xd:author>Alexei Lavrentiev alexei.lavrentev@ens-lyon.fr</xd:author>
33
		<xd:copyright>2014, CNRS / ICAR (Équipe CACTUS)</xd:copyright>
34
	</xd:doc>
35

    
36
	<xsl:template match="/">
37
		<xsl:apply-templates />
38
	</xsl:template>
39

    
40

    
41
	<xsl:template match="*">
42
		<xsl:copy>
43
			<xsl:apply-templates select="@*" />
44
			<xsl:apply-templates
45
				select="*|processing-instruction()|comment()|text()" />
46
		</xsl:copy>
47
	</xsl:template>
48

    
49
	<xsl:template match="comment()|text()">
50
		<xsl:copy />
51
	</xsl:template>
52

    
53
	<xsl:template match="processing-instruction()"></xsl:template>
54

    
55
	<!-- On supprime les attributs par défaut de la DTD TEI -->
56

    
57
	<xsl:template match="@*">
58
		<xsl:choose>
59
			<xsl:when
60
				test="matches(name(.),'^(part|instant|anchored|full)$')" />
61
			<xsl:when test="matches(name(.),'rend')">
62
				<xsl:choose>
63
					<xsl:when test="matches(.,'^aggl$')">
64
						<xsl:attribute name="rend">space-after(none)</xsl:attribute>
65
					</xsl:when>
66
					<xsl:otherwise>
67
						<xsl:copy />
68
					</xsl:otherwise>
69
				</xsl:choose>
70
			</xsl:when>
71
			<xsl:otherwise>
72
				<xsl:copy />
73
			</xsl:otherwise>
74
		</xsl:choose>
75
	</xsl:template>
76

    
77
	<xsl:template match="tei:teiHeader">
78
		<xsl:copy>
79
			<xsl:apply-templates select="@*" />
80
			<xsl:apply-templates />
81
		</xsl:copy>
82
	</xsl:template>
83

    
84
	<xsl:template match="tei:revisionDesc">
85
		<xsl:copy>
86
			<xsl:apply-templates select="@*" />
87
			<change xmlns="http://www.tei-c.org/ns/1.0"
88
				when="{format-date(current-date(),'[Y]-[M01]-[D01]')}" who="#auto">Conversion
89
				automatique au format XML-TEI-Oriflamms</change>
90
			<xsl:apply-templates />
91
		</xsl:copy>
92
	</xsl:template>
93

    
94
	<xsl:template match="tei:encodingDesc">
95
		<xsl:copy>
96
			<xsl:apply-templates select="@*" />
97
			<xsl:apply-templates />
98
			<xsl:if test="not(//tei:prefixDef[@ident='ori'])">
99
				<listPrefixDef xmlns="http://www.tei-c.org/ns/1.0">
100
					<prefixDef xmlns="http://www.tei-c.org/ns/1.0"
101
						ident="ori" matchPattern="([a-z]+)"
102
						replacementPattern="oriflamms-annotation-scheme.xml#$1">
103
						<p>
104
							In the context of this project, private URIs with the prefix
105
							"ori" point to
106
							<gi>interp</gi>
107
							elements in the project's
108
							oriflamms-annotation-scheme.xml file.
109
						</p>
110
					</prefixDef>
111
				</listPrefixDef>
112
			</xsl:if>
113
		</xsl:copy>
114
	</xsl:template>
115

    
116

    
117
	<xsl:template match="tei:cb[@rend='hidden']">
118
		<xsl:comment>
119
			cb factice supprimé
120
		</xsl:comment>
121
	</xsl:template>
122

    
123
	<xsl:template match="tei:note|tei:supplied">
124
		<xsl:copy>
125
			<xsl:apply-templates select="@*" />
126
			<xsl:attribute name="ana">
127
      <xsl:if test="@ana"><xsl:value-of
128
				select="concat(@ana,' ')" /></xsl:if>
129
      <xsl:text>ori:align-no</xsl:text>
130
    </xsl:attribute>
131
			<xsl:apply-templates />
132
		</xsl:copy>
133
	</xsl:template>
134

    
135
	<!--<xsl:template match="tei:pb[not(preceding-sibling::*[1][self::tei:milestone[@unit='surface']] 
136
		or ancestor::tei:supplied)]"> <milestone xmlns="http://www.tei-c.org/ns/1.0" 
137
		unit="surface" facs="{@facs}"/> <xsl:copy> <xsl:apply-templates select="@*"/> 
138
		</xsl:copy> </xsl:template> -->
139

    
140
	<xsl:template match="tei:w[matches(@type,'^PON')]">
141
		<pc xmlns="http://www.tei-c.org/ns/1.0">
142
			<xsl:apply-templates select="@*" />
143
			<xsl:analyze-string select="."
144
				regex="^(.*)%(.*)%(.*)$">
145
				<xsl:matching-substring>
146
					<xsl:choose>
147
						<xsl:when test="matches(regex-group(3),'^$')">
148
							<xsl:attribute name="ana">ori:align-no</xsl:attribute>
149
							<reg xmlns="http://www.tei-c.org/ns/1.0" ana="ori:align-no">
150
								<xsl:value-of select="regex-group(1)" />
151
							</reg>
152
						</xsl:when>
153
						<xsl:when test="matches(regex-group(1),'^$')">
154
							<orig xmlns="http://www.tei-c.org/ns/1.0">
155
								<xsl:value-of select="regex-group(3)" />
156
							</orig>
157
						</xsl:when>
158
						<xsl:otherwise>
159
							<choice xmlns="http://www.tei-c.org/ns/1.0">
160
								<reg xmlns="http://www.tei-c.org/ns/1.0" ana="ori:align-no">
161
									<xsl:value-of select="regex-group(1)" />
162
								</reg>
163
								<orig xmlns="http://www.tei-c.org/ns/1.0">
164
									<xsl:value-of select="regex-group(3)" />
165
								</orig>
166
							</choice>
167
						</xsl:otherwise>
168
					</xsl:choose>
169
				</xsl:matching-substring>
170
				<xsl:non-matching-substring>
171
					<xsl:value-of select="." />
172
				</xsl:non-matching-substring>
173
			</xsl:analyze-string>
174
		</pc>
175
	</xsl:template>
176

    
177
	<xsl:template match="tei:orig">
178
		<xsl:apply-templates />
179
	</xsl:template>
180

    
181

    
182

    
183
	<xsl:template
184
		match="tei:w[not(matches(@type,'^PON'))]//text()|tei:del[not(ancestor::tei:w or descendant::tei:w)]//text()">
185
		<xsl:choose>
186
			<xsl:when test="matches(.,'^\s*$')">
187
				<xsl:copy />
188
			</xsl:when>
189
			<xsl:otherwise>
190
				<xsl:analyze-string select="."
191
					regex="#?\*[ijuvIJUVí]|#[A-Za-zÀ-ÿſ]|\{{\{{[^}}]+\}}\}}|#?\(\([^)]+\)\).?|_">
192
					<xsl:matching-substring>
193
						<xsl:choose>
194
							<xsl:when test="matches(.,'#\*([ij])')">
195
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-j">
196
									<xsl:value-of select="upper-case(regex-group(1))" />
197
								</g>
198
							</xsl:when>
199
							<xsl:when test="matches(.,'#\*([uv])')">
200
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-v">
201
									<xsl:value-of select="upper-case(regex-group(1))" />
202
								</g>
203
							</xsl:when>
204
							<xsl:when test="matches(.,'\*í')">
205
								<g xmlns="http://www.tei-c.org/ns/1.0"
206
									ana="ori:dipl-i ori:facs-iacute">j</g>
207
							</xsl:when>
208
							<xsl:when test="matches(.,'\*([ij])')">
209
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-j">
210
									<xsl:value-of select="regex-group(1)" />
211
								</g>
212
							</xsl:when>
213
							<xsl:when test="matches(.,'\*([uv])')">
214
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-v">
215
									<xsl:value-of select="regex-group(1)" />
216
								</g>
217
							</xsl:when>
218
							<xsl:when test="matches(.,'#\*([IJ])')">
219
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-I">
220
									<xsl:value-of select="lower-case(regex-group(1))" />
221
								</g>
222
							</xsl:when>
223
							<xsl:when test="matches(.,'#\*([UV])')">
224
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-V">
225
									<xsl:value-of select="lower-case(regex-group(1))" />
226
								</g>
227
							</xsl:when>
228
							<xsl:when test="matches(.,'\*([IJ])')">
229
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-I">
230
									<xsl:value-of select="regex-group(1)" />
231
								</g>
232
							</xsl:when>
233
							<xsl:when test="matches(.,'\*([UV])')">
234
								<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-V">
235
									<xsl:value-of select="regex-group(1)" />
236
								</g>
237
							</xsl:when>
238
							<xsl:when test="matches(.,'#ſ')">
239
								<xsl:analyze-string select="." regex="^#(.)">
240
									<xsl:matching-substring>
241
										<g xmlns="http://www.tei-c.org/ns/1.0"
242
											ana="ori:dipl-caps ori:facs-slong">S</g>
243
									</xsl:matching-substring>
244
								</xsl:analyze-string>
245
							</xsl:when>
246
							<!--  -->
247
							<!-- <xsl:when test="matches(.,'#')"> <xsl:analyze-string select="." 
248
								regex="^#(.)"> <xsl:matching-substring> <choice xmlns="http://www.tei-c.org/ns/1.0"> 
249
								<abbr xmlns="http://www.tei-c.org/ns/1.0"><xsl:value-of select="regex-group(1)"/></abbr> 
250
								<expan xmlns="http://www.tei-c.org/ns/1.0"><ex xmlns="http://www.tei-c.org/ns/1.0"><g 
251
								xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-small">E</g>t</ex></expan> 
252
								</choice> </xsl:matching-substring> </xsl:analyze-string> </xsl:when> -->
253
							<xsl:when test="matches(.,'#[A-Z]')">
254
								<xsl:analyze-string select="." regex="^#(.)">
255
									<xsl:matching-substring>
256
										<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-caps">
257
											<xsl:value-of
258
												select="lower-case(regex-group(1))" />
259
										</g>
260
									</xsl:matching-substring>
261
								</xsl:analyze-string>
262
							</xsl:when>
263
							<xsl:when test="matches(.,'#[^(]')">
264
								<xsl:analyze-string select="."
265
									regex="^#(.+)$">
266
									<xsl:matching-substring>
267
										<g xmlns="http://www.tei-c.org/ns/1.0" ana="ori:dipl-small">
268
											<xsl:value-of
269
												select="upper-case(regex-group(1))" />
270
										</g>
271
									</xsl:matching-substring>
272
								</xsl:analyze-string>
273
							</xsl:when>
274
							<xsl:when test="matches(.,'\{\{([^}}]+)\}\}')">
275
								<xsl:analyze-string select="."
276
									regex="^\{{\{{([^:]*):([^:]*):([^:]*):([^:]*):?([^:]*)\}}\}}$">
277
									<xsl:matching-substring>
278
										<xsl:variable name="lettrine">
279
											<xsl:value-of select="regex-group(1)" />
280
										</xsl:variable>
281
										<xsl:variable name="size">
282
											<xsl:value-of select="regex-group(2)" />
283
										</xsl:variable>
284
										<xsl:variable name="sizeAct">
285
											<xsl:value-of select="regex-group(3)" />
286
										</xsl:variable>
287
										<xsl:variable name="color">
288
											<xsl:value-of select="regex-group(4)" />
289
										</xsl:variable>
290
										<xsl:variable name="deco">
291
											<xsl:value-of select="regex-group(5)" />
292
										</xsl:variable>
293
										<xsl:variable name="rend">
294
											<xsl:value-of select="concat('size(',$size,')')" />
295
											<xsl:if test="matches($sizeAct,'.+')">
296
												<xsl:value-of
297
													select="concat(' sizeAct(',$sizeAct,')')" />
298
											</xsl:if>
299
											<xsl:if test="matches($color,'.+')">
300
												<xsl:value-of
301
													select="concat(' color(',$color,')')" />
302
											</xsl:if>
303
											<xsl:if test="matches($deco,'.+')">
304
												<xsl:value-of
305
													select="concat(' deco(',$deco,')')" />
306
											</xsl:if>
307
										</xsl:variable>
308
										<g xmlns="http://www.tei-c.org/ns/1.0" type="lettrine"
309
											rend="{$rend}">
310
											<xsl:value-of select="$lettrine" />
311
										</g>
312
									</xsl:matching-substring>
313
								</xsl:analyze-string>
314
							</xsl:when>
315
							<xsl:when test="matches(.,'\(\(')">
316
								<xsl:analyze-string select="."
317
									regex="^#?\(\(([^\)]+)\)\)(.?)$">
318
									<xsl:matching-substring>
319
										<xsl:variable name="capitalize">
320
											<xsl:choose>
321
												<xsl:when test="matches(.,'^#')">
322
													yes
323
												</xsl:when>
324
												<xsl:otherwise>
325
													no
326
												</xsl:otherwise>
327
											</xsl:choose>
328
										</xsl:variable>
329
										<xsl:variable name="abbrexpan">
330
											<xsl:value-of select="regex-group(1)" />
331
										</xsl:variable>
332
										<xsl:variable name="nextLetter">
333
											<xsl:value-of select="regex-group(2)" />
334
										</xsl:variable>
335
										<xsl:variable name="abbr">
336
											<xsl:choose>
337
												<xsl:when test="matches($abbrexpan,'_')">
338
													<xsl:value-of
339
														select="substring-before($abbrexpan,'_')" />
340
												</xsl:when>
341
												<xsl:when
342
													test="matches($abbrexpan,'^(.&#x0305;|.&#x0363;|.&#x0364;|.&#x0365;|bn&#x0305;|ch&#x02BC;&#xA75B;|ch&#x0305;&#xA75B;|ch&#xA75B;&#x0305;|gn&#x0363;t|qn&#x0363;t|&#x035B;|&#x1DD1;|&#x204A;|&#x223B;|&#xA76F;|&#xA770;|&#xF153;|&#xF158;|&#xF1C8;)$')">
343
													<xsl:value-of select="$abbrexpan" />
344
												</xsl:when>
345
												<xsl:otherwise />
346
											</xsl:choose>
347
										</xsl:variable>
348
										<xsl:variable name="expannocap" as="element()">
349
											<expan xmlns="http://www.tei-c.org/ns/1.0">
350
												<xsl:choose>
351
													<xsl:when test="matches($abbrexpan,'_')">
352
														<xsl:analyze-string
353
															select="substring-after($abbrexpan,'_')"
354
															regex="\[([^\]]+)\]">
355
															<xsl:matching-substring>
356
																<ex xmlns="http://www.tei-c.org/ns/1.0">
357
																	<xsl:value-of select="regex-group(1)" />
358
																</ex>
359
															</xsl:matching-substring>
360
															<xsl:non-matching-substring>
361
																<xsl:copy />
362
															</xsl:non-matching-substring>
363
														</xsl:analyze-string>
364
													</xsl:when>
365
													<xsl:when
366
														test="matches($abbrexpan,'^bn&#x0305;$')">
367
														b
368
														<ex xmlns="http://www.tei-c.org/ns/1.0">ie</ex>
369
														n
370
													</xsl:when>
371
													<xsl:when
372
														test="matches($abbrexpan,'^(ch&#x02BC;&#xA75B;|ch&#x0305;&#xA75B;|ch&#xA75B;&#x0305;)$')">
373
														ch
374
														<ex xmlns="http://www.tei-c.org/ns/1.0">evalie</ex>
375
														r
376
													</xsl:when>
377
													<xsl:when test="matches($abbrexpan,'gn&#x0363;t')">
378
														g
379
														<ex xmlns="http://www.tei-c.org/ns/1.0">r</ex>
380
														<c xmlns="http://www.tei-c.org/ns/1.0"
381
															rend="position(combsup)">a</c>
382
														nt
383
													</xsl:when>
384
													<xsl:when test="matches($abbrexpan,'qn&#x0363;t')">
385
														q
386
														<ex xmlns="http://www.tei-c.org/ns/1.0">u</ex>
387
														<c xmlns="http://www.tei-c.org/ns/1.0"
388
															rend="position(combsup)">a</c>
389
														nt
390
													</xsl:when>
391
													<xsl:when test="matches($abbrexpan,'.&#x0305;$')">
392
														<xsl:value-of
393
															select="substring($abbrexpan,1,1)" />
394
														<xsl:choose>
395
															<xsl:when
396
																test="matches($abbrexpan,'^[aeiou]') and matches($nextLetter,'[bmnp]')">
397
																<ex xmlns="http://www.tei-c.org/ns/1.0">m</ex>
398
															</xsl:when>
399
															<xsl:when test="matches($abbrexpan,'^[aeiou]')">
400
																<ex xmlns="http://www.tei-c.org/ns/1.0">n</ex>
401
															</xsl:when>
402
															<xsl:when test="matches($abbrexpan,'^[q]')">
403
																<ex xmlns="http://www.tei-c.org/ns/1.0">ue</ex>
404
															</xsl:when>
405
															<xsl:when test="matches($abbrexpan,'^[p]')">
406
																<ex xmlns="http://www.tei-c.org/ns/1.0">re</ex>
407
															</xsl:when>
408
															<xsl:otherwise>
409
																‹bar›
410
															</xsl:otherwise>
411
														</xsl:choose>
412
													</xsl:when>
413
													<xsl:when test="matches($abbrexpan,'.&#x0363;')">
414
														<xsl:value-of
415
															select="substring($abbrexpan,1,1)" />
416
														<xsl:choose>
417
															<xsl:when test="matches($abbrexpan,'^[Qq]')">
418
																<ex xmlns="http://www.tei-c.org/ns/1.0">u</ex>
419
															</xsl:when>
420
															<xsl:otherwise>
421
																<ex xmlns="http://www.tei-c.org/ns/1.0">r</ex>
422
															</xsl:otherwise>
423
														</xsl:choose>
424
														<c xmlns="http://www.tei-c.org/ns/1.0"
425
															rend="position(combsup)">a</c>
426
													</xsl:when>
427
													<xsl:when test="matches($abbrexpan,'.&#x0364;')">
428
														<xsl:value-of
429
															select="substring($abbrexpan,1,1)" />
430
														<xsl:choose>
431
															<xsl:when test="matches($abbrexpan,'^[Qq]')">
432
																<ex xmlns="http://www.tei-c.org/ns/1.0">u</ex>
433
															</xsl:when>
434
															<xsl:otherwise>
435
																<ex xmlns="http://www.tei-c.org/ns/1.0">r</ex>
436
															</xsl:otherwise>
437
														</xsl:choose>
438
														<c xmlns="http://www.tei-c.org/ns/1.0"
439
															rend="position(combsup)">e</c>
440
													</xsl:when>
441
													<xsl:when test="matches($abbrexpan,'.&#x0365;')">
442
														<xsl:value-of
443
															select="substring($abbrexpan,1,1)" />
444
														<xsl:choose>
445
															<xsl:when test="matches($abbrexpan,'^[Qq]')">
446
																<ex xmlns="http://www.tei-c.org/ns/1.0">u</ex>
447
															</xsl:when>
448
															<xsl:otherwise>
449
																<ex xmlns="http://www.tei-c.org/ns/1.0">r</ex>
450
															</xsl:otherwise>
451
														</xsl:choose>
452
														<c xmlns="http://www.tei-c.org/ns/1.0"
453
															rend="position(combsup)">i</c>
454
													</xsl:when>
455
													<xsl:when
456
														test="matches($abbrexpan,'&#xA76F;') and matches($nextLetter,'[bmnp]')">
457
														<ex xmlns="http://www.tei-c.org/ns/1.0">com</ex>
458
													</xsl:when>
459
													<xsl:when test="matches($abbrexpan,'&#xA76F;')">
460
														<ex xmlns="http://www.tei-c.org/ns/1.0">con</ex>
461
													</xsl:when>
462
													<xsl:when
463
														test="matches($abbrexpan,'&#x035B;|&#xF1C8;')">
464
														<ex xmlns="http://www.tei-c.org/ns/1.0">er</ex>
465
													</xsl:when>
466
													<xsl:when
467
														test="matches($abbrexpan,'&#x204A;|&#xF158;')">
468
														<ex xmlns="http://www.tei-c.org/ns/1.0">et</ex>
469
													</xsl:when>
470
													<xsl:when
471
														test="matches($abbrexpan,'&#x1DD1;|&#xF153;')">
472
														<ex xmlns="http://www.tei-c.org/ns/1.0">ur</ex>
473
													</xsl:when>
474
													<xsl:when test="matches($abbrexpan,'&#xA770;')">
475
														<ex xmlns="http://www.tei-c.org/ns/1.0">us</ex>
476
													</xsl:when>
477
													<xsl:otherwise>
478
														<ex xmlns="http://www.tei-c.org/ns/1.0">
479
															<xsl:value-of select="$abbrexpan" />
480
														</ex><!--<xsl:comment>Unknown expan!</xsl:comment> -->
481
													</xsl:otherwise>
482
												</xsl:choose>
483
											</expan>
484
										</xsl:variable>
485
										<xsl:variable name="expan">
486
											<xsl:choose>
487
												<xsl:when test="$capitalize eq 'yes'">
488
													<expan xmlns="http://www.tei-c.org/ns/1.0">
489
														<xsl:for-each select="$expannocap/node()">
490
															<xsl:choose>
491
																<xsl:when
492
																	test="self::text()[not(preceding-sibling::*)]">
493
																	<g xmlns="http://www.tei-c.org/ns/1.0"
494
																		ana="ori:dipl-small">
495
																		<xsl:value-of
496
																			select="upper-case(substring(.,1,1))" />
497
																	</g>
498
																	<xsl:value-of select="substring(.,2)" />
499
																</xsl:when>
500
																<xsl:when
501
																	test="self::*[not(preceding-sibling::text())]">
502
																	<xsl:copy>
503
																		<g xmlns="http://www.tei-c.org/ns/1.0"
504
																			ana="ori:dipl-small">
505
																			<xsl:value-of
506
																				select="upper-case(substring(.,1,1))" />
507
																		</g>
508
																		<xsl:value-of select="substring(.,2)" />
509
																	</xsl:copy>
510
																</xsl:when>
511
																<xsl:otherwise>
512
																	<xsl:copy-of select="." />
513
																</xsl:otherwise>
514
															</xsl:choose>
515
														</xsl:for-each>
516
													</expan>
517
												</xsl:when>
518
												<xsl:otherwise>
519
													<xsl:copy-of select="$expannocap" />
520
												</xsl:otherwise>
521
											</xsl:choose>
522
										</xsl:variable>
523
										<xsl:choose>
524
											<xsl:when test="matches($abbr,'.+')">
525
												<choice xmlns="http://www.tei-c.org/ns/1.0">
526
													<abbr xmlns="http://www.tei-c.org/ns/1.0">
527
														<xsl:copy-of select="$abbr" />
528
													</abbr>
529
													<xsl:copy-of select="$expan" />
530
												</choice>
531
											</xsl:when>
532
											<xsl:otherwise>
533
												<xsl:copy-of select="$expan" /><!--<xsl:comment>Unknown 
534
													abbr!</xsl:comment> -->
535
											</xsl:otherwise>
536
										</xsl:choose>
537
										<xsl:value-of select="$nextLetter" />
538
									</xsl:matching-substring>
539
								</xsl:analyze-string>
540
							</xsl:when>
541
							<xsl:when test="matches(.,'__')">
542
								<space xmlns="http://www.tei-c.org/ns/1.0"
543
									ana="ori:figement" />
544
							</xsl:when>
545
							<xsl:when test="matches(.,'_')">
546
								<space xmlns="http://www.tei-c.org/ns/1.0" />
547
							</xsl:when>
548
							<xsl:otherwise>
549
								Match:
550
								<xsl:copy />
551
							</xsl:otherwise>
552
						</xsl:choose>
553
					</xsl:matching-substring>
554
					<xsl:non-matching-substring>
555
						<xsl:copy />
556
					</xsl:non-matching-substring>
557
				</xsl:analyze-string>
558
			</xsl:otherwise>
559
		</xsl:choose>
560
	</xsl:template>
561

    
562

    
563

    
564
</xsl:stylesheet>