Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / tei / profiles / default / p4 / from.xsl @ 187

History | View | Annotate | Download (20.2 kB)

1
<?xml version="1.0"?>
2
<xsl:stylesheet 
3
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
    xmlns:tei="http://www.tei-c.org/ns/1.0" 
5
    xmlns="http://www.tei-c.org/ns/1.0"
6
    version="2.0">
7
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
8
      <desc>
9

    
10
         <p>This software is dual-licensed:
11

    
12
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
13
Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
14

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

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

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

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

    
30
This software is provided by the copyright holders and contributors
31
"as is" and any express or implied warranties, including, but not
32
limited to, the implied warranties of merchantability and fitness for
33
a particular purpose are disclaimed. In no event shall the copyright
34
holder or contributors be liable for any direct, indirect, incidental,
35
special, exemplary, or consequential damages (including, but not
36
limited to, procurement of substitute goods or services; loss of use,
37
data, or profits; or business interruption) however caused and on any
38
theory of liability, whether in contract, strict liability, or tort
39
(including negligence or otherwise) arising in any way out of the use
40
of this software, even if advised of the possibility of such damage.
41
</p>
42
         <p>Author: See AUTHORS</p>
43
         <p>Id: $Id: from.xsl 10048 2012-01-18 10:03:59Z rahtz $</p>
44
         <p>Copyright: 2008, TEI Consortium</p>
45
      </desc>
46
   </doc>
47

    
48
  <!-- 
49
       
50
       P4 to P5 converter 
51
       
52
       Sebastian Rahtz <sebastian.rahtz@oucs.ox.ac.uk>
53
       
54
       $Date: 2012-01-18 10:03:59 +0000 (Wed, 18 Jan 2012) $  $Id: from.xsl 10048 2012-01-18 10:03:59Z rahtz $
55
       
56
  -->
57
  <xsl:output method="xml" encoding="utf-8"
58
    cdata-section-elements="tei:eg" omit-xml-declaration="yes"/>
59
  
60
  <xsl:variable name="processor">
61
    <xsl:value-of select="system-property('xsl:vendor')"/>
62
  </xsl:variable>
63
  
64
  <xsl:variable name="today">
65
      <xsl:value-of select="format-dateTime(current-dateTime(),'[Y]-[M02]-[D02]T[H02]:[m02]:[s02]Z')"/>
66
  </xsl:variable>
67
  
68
  <xsl:template match="*">
69
    <xsl:choose>
70
      <xsl:when test="namespace-uri()=''">
71
	<xsl:element namespace="http://www.tei-c.org/ns/1.0" name="{local-name(.)}">
72
	  <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
73
	</xsl:element>
74
      </xsl:when>
75
      <xsl:otherwise>
76
	<xsl:copy>
77
	  <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
78
	</xsl:copy>
79
      </xsl:otherwise>
80
    </xsl:choose>
81
  </xsl:template>
82
  
83
  
84
  <xsl:template match="@*|processing-instruction()|comment()">
85
    <xsl:copy/>
86
  </xsl:template>
87
  
88
  
89
  <xsl:template match="text()">
90
    <xsl:value-of select="."/>
91
  </xsl:template>
92
  
93
    <xsl:template match="teiCorpus.2">
94
    <teiCorpus>
95
      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
96
    </teiCorpus>
97
  </xsl:template>
98
  
99
  <xsl:template match="witness/@sigil">
100
    <xsl:attribute name="xml:id">
101
      <xsl:value-of select="."/>
102
    </xsl:attribute>
103
  </xsl:template>
104

    
105
  <xsl:template match="witList">
106
    <listWit>
107
      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
108
    </listWit>
109
  </xsl:template>
110
  
111
  
112
  <xsl:template match="TEI.2">
113
    <TEI>
114
      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
115
    </TEI>
116
  </xsl:template>
117
  
118
  <xsl:template match="xref">
119
    <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="ref">
120
      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
121
    </xsl:element>
122
  </xsl:template>
123
  
124
  
125
  <xsl:template match="xptr">
126
    <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="ptr">
127
      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
128
    </xsl:element>
129
  </xsl:template>
130
  
131
  
132
  <xsl:template match="figure[@url]">
133
    <figure>
134
      <graphic>
135
	<xsl:apply-templates select="@*"/>
136
      </graphic>
137
      <xsl:apply-templates/>
138
    </figure>
139
  </xsl:template>
140
  
141
 
142
  <xsl:template match="figure/@entity"/>
143

    
144
  
145
  <xsl:template match="figure[@entity]">
146
    <figure>
147
      <graphic>
148
	<xsl:attribute name="url">
149
	  <xsl:choose>
150
	    <xsl:when test="unparsed-entity-uri(@entity)=''">
151
	      <xsl:text>ENTITY_</xsl:text>
152
	      <xsl:value-of select="@entity"/>
153
	    </xsl:when>
154
	    <xsl:otherwise>
155
	      <xsl:value-of select="unparsed-entity-uri(@entity)"/>
156
	    </xsl:otherwise>
157
	  </xsl:choose>
158
	</xsl:attribute>
159
	<xsl:apply-templates select="@*"/>
160
      </graphic>
161
      <xsl:apply-templates/>
162
    </figure>
163
  </xsl:template>
164
  
165
  <xsl:template match="event">
166
    <incident>
167
      <xsl:apply-templates select="@*|*|text()|comment()|processing-instruction()"/>
168
    </incident>
169
  </xsl:template>
170
  
171
  <xsl:template match="state">
172
    <refState>
173
      <xsl:apply-templates select="@*|*|text()|comment()|processing-instruction()"/>
174
    </refState>
175
  </xsl:template>
176
  
177
  
178
  <!-- lost elements -->
179
  <xsl:template match="dateRange">
180
    <date>
181
      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
182
    </date>
183
  </xsl:template>
184
  
185
  
186
  <xsl:template match="dateRange/@from">
187
    <xsl:copy-of select="."/>
188
  </xsl:template>
189
  
190
  <xsl:template match="dateRange/@to">
191
    <xsl:copy-of select="."/>
192
  </xsl:template>
193
  
194
  <xsl:template match="language">
195
    <xsl:element namespace="http://www.tei-c.org/ns/1.0" name="language">
196
	<xsl:if test="@id">
197
        <xsl:attribute name="ident">
198
	  <xsl:value-of select="@id"/>
199
        </xsl:attribute>
200
        </xsl:if>
201
      <xsl:apply-templates select="*|processing-instruction()|comment()|text()"/>
202
    </xsl:element>
203
  </xsl:template>
204
  
205
  <!-- attributes lost -->
206
  <!-- dropped from TEI. Added as new change records later -->
207
  <xsl:template match="@date.created"/>
208
  
209
  <xsl:template match="@date.updated"/>
210
  
211
  <!-- dropped from TEI. No replacement -->
212
  <xsl:template match="refsDecl/@doctype"/>
213
  
214
  <!-- attributes changed name -->
215
  
216
  <xsl:template match="date/@value">
217
    <xsl:attribute name="when">
218
      <xsl:value-of select="."/>
219
    </xsl:attribute>
220
  </xsl:template>
221
  
222
  
223
  <xsl:template match="@url">
224
    <xsl:attribute name="target">
225
      <xsl:value-of select="."/>
226
    </xsl:attribute>
227
  </xsl:template>
228
  
229
  <xsl:template match="figure/@url">
230
    <xsl:attribute name="url">
231
      <xsl:value-of select="."/>
232
    </xsl:attribute>
233
  </xsl:template>
234
  
235
  
236
  <xsl:template match="@doc">
237
    <xsl:attribute name="target">
238
      <xsl:value-of select="unparsed-entity-uri(.)"/>
239
    </xsl:attribute>
240
  </xsl:template>
241
  
242
  
243
  <xsl:template match="@id">
244
    <xsl:choose>
245
      <xsl:when test="parent::lang">
246
	<xsl:attribute name="ident">
247
	  <xsl:value-of select="."/>
248
	</xsl:attribute>
249
      </xsl:when>
250
      <xsl:otherwise>
251
	<xsl:attribute name="xml:id">
252
	  <xsl:value-of select="."/>
253
	</xsl:attribute>
254
      </xsl:otherwise>
255
    </xsl:choose>
256
  </xsl:template>
257
  
258
  
259
  <xsl:template match="@lang">
260
    <xsl:attribute name="xml:lang">
261
      <xsl:value-of select="."/>
262
    </xsl:attribute>
263
  </xsl:template>
264
  
265
  
266
  <xsl:template match="change/@date"/>
267
  
268
  <xsl:template match="date/@certainty">
269
    <xsl:attribute name="cert">
270
      <xsl:value-of select="."/>
271
    </xsl:attribute>
272
  </xsl:template>
273
  
274
  <!-- all pointing attributes preceded by # -->
275
  
276
  <xsl:template match="variantEncoding/@location">
277
    <xsl:copy-of select="."/>
278
  </xsl:template>
279

    
280
  <xsl:template match="@ana|@active|@adj|@adjFrom|@adjTo|@children|@class|@code|@copyOf|@corresp|@decls|@domains|@end|@exclude|@fVal|@feats|@follow|@hand|@inst|@langKey|@location|@mergedin|@new|@next|@old|@origin|@otherLangs|@parent|@passive|@perf|@prev|@render|@resp|@sameAs|@scheme|@script|@select|@since|@start|@synch|@target|@targetEnd|@value|@value|@who|@wit">
281
    <xsl:attribute name="{name(.)}">
282
      <xsl:call-template name="splitter">
283
	<xsl:with-param name="val">
284
	  <xsl:value-of select="."/>
285
	</xsl:with-param>
286
      </xsl:call-template>
287
    </xsl:attribute>
288
  </xsl:template>
289
  
290
  
291
  <xsl:template name="splitter">
292
    <xsl:param name="val"/>
293
    <xsl:choose>
294
      <xsl:when test="contains($val,' ')">
295
	<xsl:text>#</xsl:text>
296
	<xsl:value-of select="substring-before($val,' ')"/>
297
	<xsl:text> </xsl:text>
298
	<xsl:call-template name="splitter">
299
	  <xsl:with-param name="val">
300
	    <xsl:value-of select="substring-after($val,' ')"/>
301
	  </xsl:with-param>
302
	</xsl:call-template>
303
      </xsl:when>
304
      <xsl:otherwise>
305
	<xsl:text>#</xsl:text>
306
	<xsl:value-of select="$val"/>
307
      </xsl:otherwise>
308
    </xsl:choose>
309
  </xsl:template>
310
  
311
  
312
  <!-- fool around with selected elements -->
313
  
314

    
315
 <!-- imprint is no longer allowed inside bibl -->
316
 <xsl:template match="bibl/imprint">
317
    <xsl:apply-templates/>
318
  </xsl:template>
319

    
320
  <xsl:template match="editionStmt/editor">
321
    <respStmt>    
322
      <resp><xsl:value-of select="@role"/></resp>
323
      <name><xsl:apply-templates/></name>
324
    </respStmt>
325
  </xsl:template>
326
  
327
  <!-- header -->  
328
  
329
  <xsl:template match="teiHeader">
330
    <teiHeader>
331
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()"/>
332
      
333
      <xsl:if test="not(revisionDesc) and (@date.created or @date.updated)">
334
	<revisionDesc>
335
	  <xsl:if test="@date.updated">
336
	    <change>>
337
	    <label>updated</label>
338
	    <date>
339
	      <xsl:value-of select="@date.updated"/>
340
	    </date>
341
	    <label>Date edited</label>
342
	    </change>
343
	  </xsl:if>
344
	  <xsl:if test="@date.created">
345
	    <change>
346
	      <label>created</label>
347
	      <date>
348
		<xsl:value-of select="@date.created"/>
349
	      </date>
350
	      <label>Date created</label>
351
	    </change>
352
	  </xsl:if>
353
	</revisionDesc>
354
      </xsl:if>
355
      <!--
356
	  <change when="{$today}">Converted to TEI P5 XML by p4top5.xsl
357
	  written by Sebastian
358
	  Rahtz at Oxford University Computing Services.</change>
359
	  </revisionDesc>
360
	  </xsl:if>
361
      -->
362
    </teiHeader>
363
  </xsl:template>
364
  
365
  <xsl:template match="revisionDesc">
366
    <revisionDesc>
367
      <xsl:apply-templates
368
	  select="@*|*|comment()|processing-instruction()"/>
369
    </revisionDesc>
370
  </xsl:template>
371
  
372
  <xsl:template match="publicationStmt">
373
    <publicationStmt>
374
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()"/>
375
      <!--
376
	  <availability>
377
	  <p>Licensed under <ptr target="http://creativecommons.org/licenses/by-sa/2.0/uk/"/></p>
378
	  </availability>
379
      -->
380
    </publicationStmt>
381
  </xsl:template>
382
  
383
 <!-- space does not have @extent any more -->
384
  <xsl:template match="space/@extent">
385
    <xsl:attribute name="quantity">
386
      <xsl:value-of select="."/>
387
    </xsl:attribute>
388
  </xsl:template>
389

    
390
 <!-- word key -->
391
  <xsl:template match="entryFree/@key">
392
    <xsl:attribute name="sortKey">
393
      <xsl:value-of select="."/>
394
    </xsl:attribute>
395
  </xsl:template>
396

    
397
  <!-- tagsDecl has a compulsory namespace child now -->
398
  <xsl:template match="tagsDecl">
399
    <xsl:if test="*">
400
      <tagsDecl>
401
	<namespace name="http://www.tei-c.org/ns/1.0">
402
	  <xsl:apply-templates select="*|comment()|processing-instruction"/>
403
	</namespace>
404
      </tagsDecl>
405
    </xsl:if>
406
  </xsl:template>
407
  
408
  <!-- orgTitle inside orgName? redundant -->
409
  <xsl:template match="orgName/orgTitle">
410
      <xsl:apply-templates/>
411
  </xsl:template>
412

    
413
 <!-- no need for empty <p> in sourceDesc -->  
414
  <xsl:template match="sourceDesc/p[string-length(.)=0]"/>
415
  
416
  <!-- start creating the new choice element -->
417
  <xsl:template match="corr[@sic]">
418
    <choice>
419
      <corr>
420
	<xsl:value-of select="text()" />
421
      </corr>
422
      <sic>
423
	<xsl:value-of select="@sic" />
424
      </sic>
425
    </choice>
426
  </xsl:template>
427
  
428
  <xsl:template match="gap/@desc"/>
429

    
430
  <xsl:template match="gap">
431
    <gap>
432
      <xsl:apply-templates select="@*"/>
433
      <xsl:if test="@desc">
434
	<desc>
435
	  <xsl:value-of select="@desc"/>
436
	</desc>
437
      </xsl:if>
438
    </gap>
439
  </xsl:template>
440

    
441
  <xsl:template match="sic[@corr]">
442
    <choice>
443
      <sic>
444
	<xsl:apply-templates/>
445
      </sic>
446
      <corr>
447
	<xsl:value-of select="@corr" />
448
      </corr>
449
    </choice>
450
  </xsl:template>
451
  
452
  <xsl:template match="abbr[@expan]">
453
    <choice>
454
      <abbr>
455
	<xsl:apply-templates/>
456
      </abbr>
457
      <expan>
458
	<xsl:value-of select="@expan" />
459
      </expan>
460
    </choice>
461
  </xsl:template>
462
  
463
  <xsl:template match="expan[@abbr]">
464
    <choice>
465
      <expan>
466
	<xsl:apply-templates/>
467
      </expan>
468
      <abbr>
469
	<xsl:value-of select="@abbr" />
470
      </abbr>
471
    </choice>
472
  </xsl:template>
473
  
474
  <!-- special consideration for <change> element -->
475
  <xsl:template match="change">
476
    <change>
477
      <xsl:apply-templates select="item/@*"/>
478
      
479
      <xsl:apply-templates select="date"/>
480
      
481
      <xsl:if test="respStmt/resp">
482
	<label>
483
	  <xsl:value-of select="respStmt/resp/text()"/>
484
	</label>
485
      </xsl:if>
486
	<xsl:for-each select="respStmt/name">
487
	  <name>
488
	    <xsl:apply-templates
489
		select="@*|*|comment()|processing-instruction()|text()"/>
490
	  </name>
491
	</xsl:for-each>
492
	<xsl:for-each select="item">
493
	  <xsl:apply-templates
494
	      select="*|comment()|processing-instruction()|text()"/>
495
	</xsl:for-each>
496
    </change>
497
  </xsl:template>
498

    
499

    
500
  <xsl:template match="respStmt[resp]">
501
    <respStmt>
502
      <xsl:choose>
503
	<xsl:when test="resp/name">
504
	  <resp>
505
	    <xsl:value-of select="resp/text()"/>
506
	  </resp>
507
	    <xsl:for-each select="resp/name">
508
	      <name>
509
		<xsl:apply-templates/>
510
	      </name>
511
	    </xsl:for-each>
512
	</xsl:when>
513
	<xsl:otherwise>
514
	  <xsl:apply-templates/>
515
	  <name>
516
	  </name>
517
	</xsl:otherwise>
518
      </xsl:choose>
519
    </respStmt>
520
  </xsl:template>
521

    
522
  <xsl:template match="q/@direct"/>
523
  
524
  <xsl:template match="q">
525
    <q>
526
      <xsl:apply-templates
527
	  select="@*|*|comment()|processing-instruction()|text()"/>
528
    </q>
529
  </xsl:template>
530

    
531
  
532
<!-- if we are reading the P4 with a DTD,
533
       we need to avoid copying the default values
534
       of attributes -->
535
  
536
  <xsl:template match="@targOrder">
537
    <xsl:if test="not(lower-case(.) ='u')">
538
      <xsl:attribute name="targOrder">
539
	<xsl:value-of select="."/>
540
      </xsl:attribute>
541
    </xsl:if>
542
  </xsl:template>
543
  
544
  
545
  <xsl:template match="@opt">
546
    <xsl:if test="not(lower-case(.) ='n')">
547
      <xsl:attribute name="opt">
548
	<xsl:value-of select="."/>
549
      </xsl:attribute>
550
    </xsl:if>
551
  </xsl:template>
552
  
553
  
554
  <xsl:template match="@to">
555
    <xsl:if test="not(lower-case(.) ='ditto')">
556
      <xsl:attribute name="to">
557
	<xsl:value-of select="."/>
558
      </xsl:attribute>
559
    </xsl:if>
560
  </xsl:template>
561

    
562
  <xsl:template match="xptr/@to">
563
      <xsl:attribute name="target">
564
	<xsl:value-of select="."/>
565
      </xsl:attribute>
566
  </xsl:template>
567
  
568
  <xsl:template match="interp/@value">
569
      <xsl:attribute name="inst">
570
	<xsl:value-of select="."/>
571
      </xsl:attribute>
572
  </xsl:template>
573
  
574
  
575
  <xsl:template match="@default">
576
    <xsl:choose>
577
      <xsl:when test="lower-case(.)= 'no'"/>
578
      <xsl:otherwise>
579
	<xsl:attribute name="default">
580
	  <xsl:value-of select="."/>
581
	</xsl:attribute>
582
      </xsl:otherwise>
583
    </xsl:choose>
584
  </xsl:template>
585
  
586
  
587
  <xsl:template match="@part">
588
    <xsl:if test="not(lower-case(.) ='n')">
589
      <xsl:attribute name="part">
590
	<xsl:value-of select="."/>
591
      </xsl:attribute>
592
    </xsl:if>
593
  </xsl:template>
594
  
595
  
596
  <xsl:template match="@full">
597
    <xsl:if test="not(lower-case(.) ='yes')">
598
      <xsl:attribute name="full">
599
	<xsl:value-of select="."/>
600
      </xsl:attribute>
601
    </xsl:if>
602
  </xsl:template>
603
  
604
  
605
  <xsl:template match="@from">
606
    <xsl:if test="not(lower-case(.) ='root')">
607
      <xsl:attribute name="from">
608
	<xsl:value-of select="."/>
609
      </xsl:attribute>
610
    </xsl:if>
611
  </xsl:template>
612
  
613
  
614
  <xsl:template match="@status">
615
    <xsl:choose>
616
      <xsl:when test="parent::teiHeader">
617
	<xsl:if test="not(lower-case(.) ='new')">
618
	  <xsl:attribute name="status">
619
	    <xsl:value-of select="."/>
620
	  </xsl:attribute>
621
	</xsl:if>
622
      </xsl:when>
623
      <xsl:when test="parent::del">
624
	<xsl:if test="not(lower-case(.) ='unremarkable')">
625
	  <xsl:attribute name="status">
626
	    <xsl:value-of select="."/>
627
	  </xsl:attribute>
628
	</xsl:if>
629
      </xsl:when>
630
      <xsl:otherwise>
631
	<xsl:attribute name="status">
632
	  <xsl:value-of select="."/>
633
	</xsl:attribute>
634
      </xsl:otherwise>
635
    </xsl:choose>
636
  </xsl:template>
637
  
638
  
639
  <xsl:template match="@place">
640
    <xsl:if test="not(lower-case(.) ='unspecified')">
641
      <xsl:attribute name="place">
642
	<xsl:value-of select="."/>
643
      </xsl:attribute>
644
    </xsl:if>
645
  </xsl:template>
646
  
647
  
648
  <xsl:template match="@sample">
649
    <xsl:if test="not(lower-case(.) ='complete')">
650
      <xsl:attribute name="sample">
651
	<xsl:value-of select="."/>
652
      </xsl:attribute>
653
    </xsl:if>
654
  </xsl:template>
655
  
656
  
657
  <xsl:template match="@org">
658
    <xsl:if test="not(lower-case(.) ='uniform')">
659
      <xsl:attribute name="org">
660
	<xsl:value-of select="."/>
661
      </xsl:attribute>
662
    </xsl:if>
663
  </xsl:template>
664
  
665
  <xsl:template match="teiHeader/@type">
666
    <xsl:if test="not(lower-case(.) ='text')">
667
      <xsl:attribute name="type">
668
	<xsl:value-of select="."/>
669
      </xsl:attribute>
670
    </xsl:if>
671
  </xsl:template>
672
  
673
  <!-- yes|no to boolean -->
674
  
675
  <xsl:template match="@anchored">
676
    <xsl:attribute name="anchored">
677
      <xsl:choose>
678
	<xsl:when test="lower-case(.)='yes'">true</xsl:when>
679
	<xsl:when test="lower-case(.)='no'">false</xsl:when>
680
      </xsl:choose>
681
    </xsl:attribute>
682
  </xsl:template>
683
  
684
  <xsl:template match="sourceDesc/@default"/>
685
  
686
  <xsl:template match="@tei">
687
    <xsl:attribute name="tei">
688
      <xsl:choose>
689
	<xsl:when test="lower-case(.)='yes'">true</xsl:when>
690
	<xsl:when test="lower-case(.)='no'">false</xsl:when>
691
      </xsl:choose>
692
    </xsl:attribute>
693
  </xsl:template>
694
  
695
  <xsl:template match="@langKey"/>  
696
  
697
  <xsl:template match="@TEIform"/>  
698

    
699
<!-- assorted atts -->
700

    
701
  <xsl:template match="gi/@TEI">  	 
702
    <xsl:if test=".='yes'">
703
      <xsl:attribute name="scheme">TEI</xsl:attribute>
704
    </xsl:if>
705
  </xsl:template>
706

    
707
  <xsl:template match="@old"/>  
708

    
709
  <xsl:template match="ref/@from"/>  
710

    
711
  <xsl:template match="@mergedin">  
712
    <xsl:attribute name="mergedIn">
713
      <xsl:value-of select="."/>
714
    </xsl:attribute>
715
  </xsl:template>
716

    
717
<!-- deal with the loss of div0 -->  
718

    
719
  <xsl:template match="div0|div1|div2|div3|div4|div5|div6">
720
    <xsl:element name="div" namespace="http://www.tei-c.org/ns/1.0">
721
      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
722
    </xsl:element>
723
  </xsl:template>
724

    
725

    
726
<!-- from Conal Tuohy -->
727
<xsl:template match="orig[@reg]">
728
  <choice>
729
    <orig>
730
      <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
731
    </orig>
732
    <reg>
733
      <xsl:value-of select="@reg"/>
734
    </reg>
735
  </choice>
736
</xsl:template>
737

    
738
<xsl:template match="reg[@orig]">
739
  <choice>
740
    <reg><xsl:apply-templates select="*|@*|processing-instruction()|
741
    comment()|text()"/></reg>
742
    <orig><xsl:value-of select="@orig"/></orig>
743
  </choice>
744
</xsl:template>
745

    
746
<xsl:template match="@orig|@reg"/>
747

    
748
<!-- remove default values for attributes -->
749

    
750
<xsl:template match="row/@role[.='data']"/>
751
<xsl:template match="cell/@role[.='data']"/>
752
<xsl:template match="cell/@rows[.='1']"/>
753
<xsl:template match="cell/@cols[.='1']"/>
754
<xsl:template match="q/@broken[.='no']"/>
755

    
756
  <xsl:template match="text[not(parent::TEI.2)]">
757
    <floatingText>
758
	<xsl:apply-templates 
759
	    select="*|@*|processing-instruction()|comment()|text()"/>
760
    </floatingText>
761
  </xsl:template>
762

    
763
<!-- from CES -->
764
  <xsl:template match="cesdoc">
765
    <cesDoc>
766
    <xsl:apply-templates 
767
        select="*|@*|processing-instruction()|comment()|text()"/>
768
    </cesDoc>
769
</xsl:template>
770

    
771
<!-- found in Perseus -->
772

    
773
  <xsl:template match="lg1|lg2|lg3|lg4">
774
    <lg>
775
    <xsl:apply-templates 
776
        select="*|@*|processing-instruction()|comment()|text()"/>
777
    </lg>
778
  </xsl:template>
779

    
780
<!-- from OTA DTD -->
781
  <xsl:template match="spkr">
782
    <speaker>
783
    <xsl:apply-templates 
784
        select="*|@*|processing-instruction()|comment()|text()"/>
785
    </speaker>
786
  </xsl:template>
787

    
788
  <xsl:template match="letter">
789
    <floatingText type="letter">
790
      <body>
791
	<xsl:apply-templates 
792
	    select="*|@*|processing-instruction()|comment()|text()"/>
793
      </body>
794
    </floatingText>
795
  </xsl:template>
796

    
797

    
798
</xsl:stylesheet>