-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathxml2XLingPapCommonConcatMorphemes.xsl
More file actions
532 lines (532 loc) · 22.9 KB
/
Copy pathxml2XLingPapCommonConcatMorphemes.xsl
File metadata and controls
532 lines (532 loc) · 22.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- This stylesheet contains the common components for XLingPap word-aligned output -->
<!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Elements to ignore or are handled elsewhere
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<xsl:template match=" item"/>
<!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OutputFreeWithAnyNotes
Output a free element and include any notes it might have
Parameters: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<xsl:template name="OutputFreeWithAnyNotes">
<xsl:variable name="sThisTextId" select="substring-before(ancestor::interlinear-text/@guid,'-')"/>
<free>
<xsl:call-template name="GetFreeLangAttribute"/>
<xsl:apply-templates/>
<xsl:variable name="sLang" select="@lang"/>
<xsl:if test="preceding-sibling::item[@type='note' and @lang=$sLang] or following-sibling::item[@type='note' and @lang=$sLang]">
<xsl:for-each select="preceding-sibling::item[@type='note' and @lang=$sLang] | following-sibling::item[@type='note' and @lang=$sLang]">
<xsl:variable name="sEndnoteNumber">
<xsl:number level="any" count="item[@type='note']" format="1"/>
</xsl:variable>
<endnote id="n{$sThisTextId}.{$sEndnoteNumber}">
<p>
<xsl:apply-templates/>
</p>
</endnote>
</xsl:for-each>
</xsl:if>
</free>
</xsl:template>
<!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OutputGlossWithPrependOrAppend
Output a gloss with any prepended or appended material
Parameters: sType = type of item to use
sLang = language id currently being used
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<xsl:template name="OutputGlossWithPrependOrAppend">
<xsl:param name="sType"/>
<xsl:param name="sLang"/>
<xsl:variable name="sGlossPrepend" select="normalize-space(item[@type='glsPrepend' and @lang=$sLang])"/>
<xsl:if test="string-length($sGlossPrepend) > 0">
<xsl:value-of select="$sGlossPrepend"/>
</xsl:if>
<xsl:value-of select="normalize-space(item[@type=$sType and @lang=$sLang])"/>
<xsl:variable name="sGlossAppend" select="normalize-space(item[@type='glsAppend' and @lang=$sLang])"/>
<xsl:if test="string-length($sGlossAppend) > 0">
<xsl:value-of select="$sGlossAppend"/>
</xsl:if>
</xsl:template>
<!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OutputInterlinearContent
Output the content of an interlinear portion
Parameters: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<xsl:template name="OutputInterlinearContent">
<!-- <xsl:for-each select="words/word[item/@type='txt' or morphemes][1]/descendant-or-self::item">
-->
<lineGroup>
<xsl:variable name="iPunct" select="count(words/word[item[@type='punct']])"/>
<xsl:variable name="iWord" select="count(words/word)"/>
<xsl:choose>
<xsl:when test="$iPunct = $iWord">
<!-- every word is punctuation; still create a line using each word's language -->
<line>
<xsl:for-each select="parent::words/word">
<wrd lang="{item/@lang}-baseline">
<xsl:value-of select="item"/>
</wrd>
</xsl:for-each>
</line>
</xsl:when>
<xsl:otherwise>
<!-- this is the case before handling punctuation only lines -->
<xsl:for-each select="words/word[item/@type='txt' or morphemes][1]/descendant-or-self::item | words/word/morphemes/morph[1][not(item)]">
<xsl:variable name="sLang" select="@lang"/>
<xsl:choose>
<xsl:when test="parent::word">
<xsl:if test="@type='txt' or @type='punct'">
<!-- word -->
<line>
<!-- word -->
<xsl:for-each select="ancestor::words/word/item[@type='txt' and @lang=$sLang]">
<wrd>
<langData>
<xsl:variable name="iBaselineSiblingsCount" select="count(preceding-sibling::item[@type='txt'])"/>
<xsl:call-template name="GetWordLangAttribute"/>
<xsl:if test="$iBaselineSiblingsCount=0">
<!-- prepend any initial punctuation only to the first line -->
<xsl:for-each select="../preceding-sibling::word[1]/item[@type='punct']">
<xsl:choose>
<xsl:when test="count(../preceding-sibling::word)=0">
<!-- it's the first word item -->
<xsl:value-of select="normalize-space(.)"/>
</xsl:when>
<xsl:when test="../preceding-sibling::word[1][item/@type='punct']">
<!-- there are other punct items before it -->
<xsl:variable name="iPreviousTextItem" select="count(../preceding-sibling::word[item/@type='txt'])"/>
<xsl:choose>
<xsl:when test="$iPreviousTextItem=0">
<!-- everything before is punctuation; prepend them all -->
<xsl:for-each select="../preceding-sibling::word[item/@type='punct']">
<xsl:value-of select="normalize-space(.)"/>
</xsl:for-each>
<!-- include this one, too -->
<xsl:value-of select="normalize-space(.)"/>
</xsl:when>
<xsl:otherwise>
<!-- assume only the last one is preceding punct -->
<xsl:value-of select="normalize-space(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="contains(.,'(') or contains(.,'[') or contains(.,'{') or contains(.,'“') or contains(.,'‘')">
<!-- there are other preceding word items; look for preceding punctuation N.B. may well need to look for characters, too -->
<xsl:value-of select="normalize-space(.)"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:if>
<!-- output the word -->
<xsl:value-of select="normalize-space(.)"/>
<xsl:if test="$iBaselineSiblingsCount=0">
<!-- append any following punctuation only to the first line -->
<xsl:if test="../following-sibling::word[1]/item[@type='punct']">
<xsl:variable name="iFollowingTextItem" select="count(../following-sibling::word[item/@type='txt'])"/>
<xsl:choose>
<xsl:when test="$iFollowingTextItem=0">
<!-- everything after is punctuation; append them all -->
<xsl:for-each select="../following-sibling::word[item/@type='punct']">
<xsl:value-of select="normalize-space(translate(.,'§',''))"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="../following-sibling::word[1]/item[@type='punct']">
<xsl:if test="not(contains(.,'(') or contains(.,'[') or contains(.,'{') or contains(.,'“') or contains(.,'‘'))">
<!-- skip any preceding punctuation N.B. may well need to look for characters, too -->
<xsl:value-of select="normalize-space(translate(.,'§',''))"/>
</xsl:if>
</xsl:for-each>
<!-- check for a second consecutive punctuation item -->
<xsl:for-each select="../following-sibling::word[2]/item[@type='punct']">
<xsl:if test="not(contains(.,'(') or contains(.,'[') or contains(.,'{') or contains(.,'“') or contains(.,'‘'))">
<!-- skip any preceding punctuation N.B. may well need to look for characters, too -->
<xsl:value-of select="normalize-space(translate(.,'§',''))"/>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:if>
</langData>
</wrd>
</xsl:for-each>
</line>
</xsl:if>
<!-- word gloss -->
<xsl:call-template name="OutputLineOfWrdElementsFromWord">
<xsl:with-param name="sType" select="'gls'"/>
<xsl:with-param name="sLang" select="$sLang"/>
</xsl:call-template>
<!-- word cat -->
<xsl:call-template name="OutputLineOfWrdElementsFromWord">
<xsl:with-param name="sType" select="'pos'"/>
<xsl:with-param name="sLang" select="$sLang"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="name()='morph'">
<!-- first word does not have an analysis -->
<xsl:if test="not(ancestor::word[preceding-sibling::word/morphemes/morph/item])">
<!-- avoid some duplications -->
<xsl:variable name="nextWord" select="ancestor::word/following-sibling::word[1]"/>
<xsl:choose>
<xsl:when test="not($nextWord/morphemes)">
<!-- very rare case: the next word does not even have blank analysis items
find the next word which has filled in analysis items -->
<xsl:for-each select="ancestor::word/following-sibling::word[morphemes/morph/item][1]/morphemes/morph/item">
<xsl:variable name="sLang2" select="@lang"/>
<xsl:call-template name="ProcessMorphItem">
<xsl:with-param name="sLang" select="$sLang2"/>
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="ancestor::word/following-sibling::word[1]/morphemes/morph/item">
<xsl:variable name="sLang2" select="@lang"/>
<xsl:call-template name="ProcessMorphItem">
<xsl:with-param name="sLang" select="$sLang2"/>
</xsl:call-template>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:when>
<xsl:when test="parent::morph[count(preceding-sibling::morph)=0]">
<xsl:call-template name="ProcessMorphItem">
<xsl:with-param name="sLang" select="$sLang"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</lineGroup>
<xsl:for-each select="item">
<xsl:choose>
<xsl:when test="@type='txt'">
<!-- what is this for? -->
</xsl:when>
<xsl:when test="@type='gls'">
<xsl:call-template name="OutputFreeWithAnyNotes"/>
</xsl:when>
<xsl:when test="@type='lit' ">
<!-- someday we'll have a literal translation element in XLingPaper -->
<free>
<xsl:call-template name="GetFreeLangAttribute"/>
<object type="tLiteralTranslation">
<xsl:apply-templates/>
</object>
</free>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="ProcessMorphItem">
<xsl:param name="sLang"/>
<!-- morphemes -->
<xsl:call-template name="OutputLineOfWrdElementsFromMorphs">
<xsl:with-param name="sType" select="'txt'"/>
<xsl:with-param name="sLang" select="$sLang"/>
</xsl:call-template>
<!-- Lex Entries -->
<xsl:call-template name="OutputLineOfWrdElementsFromMorphs">
<xsl:with-param name="sType" select="'cf'"/>
<xsl:with-param name="sLang" select="$sLang"/>
</xsl:call-template>
<!-- Gloss -->
<xsl:call-template name="OutputLineOfWrdElementsFromMorphs">
<xsl:with-param name="sType" select="'gls'"/>
<xsl:with-param name="sLang" select="$sLang"/>
<xsl:with-param name="bAddHyphen" select="'Y'"/>
</xsl:call-template>
<!-- msa -->
<xsl:call-template name="OutputLineOfWrdElementsFromMorphs">
<xsl:with-param name="sType" select="'msa'"/>
<xsl:with-param name="sLang" select="$sLang"/>
<xsl:with-param name="bAddHyphen" select="'Y'"/>
</xsl:call-template>
</xsl:template>
<!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OutputLineOfWrdElementsFromMorphs
Output a sequence of <wrd/> elements based on <morph/> elements
Parameters: sType = type of item to use
sLang = language id currently being used
bAddHyphen = flag whether to add hyphen between morphs
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<xsl:template name="OutputLineOfWrdElementsFromMorphs">
<xsl:param name="sType"/>
<xsl:param name="sLang"/>
<xsl:param name="bAddHyphen"/>
<xsl:if test="@type=$sType and @lang=$sLang">
<line>
<xsl:for-each select="ancestor::words/word">
<xsl:choose>
<xsl:when test="morphemes[morph/item[@type=$sType and @lang=$sLang]]">
<xsl:for-each select="morphemes[morph/item[@type=$sType and @lang=$sLang]]">
<wrd>
<xsl:variable name="vernacularLanguageMissingInPhase1">
<xsl:variable name="sBeforeLastHyphenId">
<xsl:call-template name="GetPortionBeforeLastHyphen">
<xsl:with-param name="pText" select="$sLang"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="sBeforeFirstHyphenId">
<xsl:value-of select="substring-before($sLang,'-')"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="//language[@lang=$sBeforeFirstHyphenId]/@vernacular='true'">
<xsl:text>Y</xsl:text>
</xsl:when>
<xsl:when test="//language[@lang=$sBeforeLastHyphenId]/@vernacular='true'">
<xsl:text>Y</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>N</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="key('Language',morph/item[@type=$sType and @lang=$sLang]/@lang)/@vernacular='true' or $vernacularLanguageMissingInPhase1='Y'">
<langData>
<xsl:for-each select="morph/item[@type=$sType and @lang=$sLang]">
<xsl:call-template name="GetMorphLangAttribute"/>
</xsl:for-each>
<xsl:call-template name="OutputMorphs">
<xsl:with-param name="sType" select="$sType"/>
<xsl:with-param name="sLang" select="$sLang"/>
<xsl:with-param name="bAddHyphen" select="$bAddHyphen"/>
</xsl:call-template>
</langData>
</xsl:when>
<xsl:when test="$sType='gls'">
<gloss>
<xsl:for-each select="morph/item[@type=$sType and @lang=$sLang]">
<xsl:call-template name="GetMorphLangAttribute"/>
</xsl:for-each>
<xsl:call-template name="OutputMorphs">
<xsl:with-param name="sType" select="$sType"/>
<xsl:with-param name="sLang" select="$sLang"/>
<xsl:with-param name="bAddHyphen" select="$bAddHyphen"/>
<xsl:with-param name="bIsGloss" select="'Y'"/>
</xsl:call-template>
</gloss>
</xsl:when>
<xsl:when test="$sType='msa'">
<gloss>
<xsl:for-each select="morph/item[@type=$sType and @lang=$sLang]">
<xsl:call-template name="GetMorphLangAttribute"/>
</xsl:for-each>
<!-- <object type="tGrammaticalGloss">-->
<xsl:call-template name="OutputMorphs">
<xsl:with-param name="sType" select="$sType"/>
<xsl:with-param name="sLang" select="$sLang"/>
<xsl:with-param name="bAddHyphen" select="$bAddHyphen"/>
</xsl:call-template>
<!-- </object>-->
</gloss>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="lang">
<xsl:value-of select="$sLang"/>
</xsl:attribute>
<xsl:call-template name="OutputMorphs">
<xsl:with-param name="sType" select="$sType"/>
<xsl:with-param name="sLang" select="$sLang"/>
<xsl:with-param name="bAddHyphen" select="$bAddHyphen"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</wrd>
</xsl:for-each>
</xsl:when>
<xsl:when test="item[@type='punct']">
<!-- do nothing -->
</xsl:when>
<xsl:otherwise>
<wrd>
<xsl:choose>
<xsl:when test="$sType='cf' or $sType='txt'">
<langData>
<xsl:call-template name="GetMorphLangAttribute">
<xsl:with-param name="sLang" select="$sLang"/>
<xsl:with-param name="sType" select="$sType"/>
</xsl:call-template>
<xsl:text>***</xsl:text>
</langData>
</xsl:when>
<xsl:when test="$sType='gls' or $sType='msa'">
<gloss>
<xsl:call-template name="GetMorphLangAttribute">
<xsl:with-param name="sLang" select="$sLang"/>
<xsl:with-param name="sType" select="$sType"/>
</xsl:call-template>
<xsl:text>***</xsl:text>
</gloss>
</xsl:when>
<!--<xsl:when test="$sType='msa'">
<xsl:for-each select="morph/item[@type=$sType and @lang=$sLang]">
<xsl:call-template name="GetMorphLangAttribute"/>
</xsl:for-each>
<!-\- <object type="tGrammaticalGloss">-\->
<xsl:text>***</xsl:text>
<!-\- </object>-\->
</xsl:when>-->
<xsl:otherwise>
<xsl:text>***</xsl:text>
</xsl:otherwise>
</xsl:choose>
</wrd>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</line>
</xsl:if>
</xsl:template>
<!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OutputLineOfWrdElementsFromWord
Output a sequence of <wrd/> elements based on <word/> elements
Parameters: sType = type of item to use
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<xsl:template name="OutputLineOfWrdElementsFromWord">
<xsl:param name="sType"/>
<xsl:param name="sLang"/>
<xsl:if test="@type=$sType and @lang=$sLang">
<line>
<xsl:for-each select="ancestor::words/word/item[@type=$sType and @lang=$sLang]">
<xsl:choose>
<xsl:when test="@type=$sType">
<wrd>
<gloss>
<xsl:call-template name="GetWordLangAttribute"/>
<xsl:value-of select="normalize-space(.)"/>
</gloss>
</wrd>
</xsl:when>
<xsl:when test="@type='punct'">
<!-- do nothing -->
</xsl:when>
<xsl:otherwise>
<wrd>
<gloss>
<xsl:call-template name="GetWordLangAttribute"/>
<xsl:text>***</xsl:text>
</gloss>
</wrd>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</line>
</xsl:if>
</xsl:template>
<!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OutputMorphs
Output a sequence of morphs
Parameters: sType = type of item to use
bAddHyphen = flag whether to add hyphen between morphs
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<xsl:template name="OutputMorphs">
<xsl:param name="sType"/>
<xsl:param name="sLang"/>
<xsl:param name="bAddHyphen"/>
<xsl:param name="bIsGloss" select="'N'"/>
<xsl:variable name="iCountOfMorphs" select="count(morph)"/>
<xsl:for-each select="morph">
<xsl:if test="position()!=1">
<xsl:choose>
<xsl:when test="$bAddHyphen='Y'">
<xsl:if test="preceding-sibling::morph[1]/@guid!=$sProclitic and @guid!=$sEnclitic">
<!-- proclitics and enclitics already have an equal sign, so do not add a hyphen -->
<xsl:value-of select="$sHyphen"/>
</xsl:if>
</xsl:when>
<xsl:when test="@guid=$sStem or @guid=$sRoot or @guid=$sBoundStem or @guid=$sBoundRoot ">
<xsl:variable name="previousMorphType" select="preceding-sibling::*[1]/@guid"/>
<xsl:if
test="$previousMorphType=$sStem or $previousMorphType=$sRoot or $previousMorphType=$sBoundStem or $previousMorphType=$sBoundRoot or $previousMorphType=$sEnclitic or $previousMorphType=$sSuffixingInterfix or $previousMorphType=$sSuffix">
<xsl:value-of select="$sHyphen"/>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:choose>
<xsl:when test="$bIsGloss='Y' and @guid!=$sBoundRoot and @guid!=$sBoundStem and @guid!=$sRoot and @guid!=$sStem and @guid!=$sPhrase and @guid!=$sDiscontiguousPhrase">
<xsl:if test="@guid=$sEnclitic">
<xsl:text>=</xsl:text>
</xsl:if>
<!--<object type="tGrammaticalGloss">-->
<xsl:choose>
<xsl:when test="@guid=$sEnclitic">
<xsl:value-of select="substring-after(normalize-space(item[@type=$sType and @lang=$sLang]), '=')"/>
</xsl:when>
<xsl:when test="@guid=$sProclitic">
<xsl:value-of select="substring-before(normalize-space(item[@type=$sType and @lang=$sLang]), '=')"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="OutputGlossWithPrependOrAppend">
<xsl:with-param name="sType" select="$sType"/>
<xsl:with-param name="sLang" select="$sLang"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!-- </object>-->
<xsl:if test="@guid=$sProclitic">
<xsl:text>=</xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="$iCountOfMorphs > 1 and $sType='msa' and @guid!=$sEnclitic or $iCountOfMorphs > 1 and $sType='msa' and @guid!=$sProclitic">
<xsl:if test="@guid=$sEnclitic">
<xsl:text>=</xsl:text>
</xsl:if>
<xsl:value-of select="normalize-space(item[@type=$sType and @lang=$sLang])"/>
<xsl:if test="@guid=$sProclitic">
<xsl:text>=</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$sType='gls'">
<xsl:call-template name="OutputGlossWithPrependOrAppend">
<xsl:with-param name="sType" select="$sType"/>
<xsl:with-param name="sLang" select="$sLang"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(item[@type=$sType and @lang=$sLang])"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$sType='cf'">
<xsl:variable name="homographNumber" select="item[@type='hn']"/>
<xsl:if test="$homographNumber">
<object type="tHomographNumber">
<xsl:value-of select="$homographNumber"/>
</object>
</xsl:if>
<xsl:variable name="variantTypes" select="item[@type='variantTypes']"/>
<xsl:if test="$variantTypes">
<object type="tVariantTypes">
<xsl:value-of select="$variantTypes"/>
</object>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:include href="xml2XLingPapAllCommon.xsl"/>
</xsl:stylesheet>