Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / tei / xhtml2 / textstructure.xsl @ 187

History | View | Annotate | Download (107.7 kB)

1
<?xml version="1.0" encoding="utf-8"?>
2
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"  xmlns:xlink="http://www.w3.org/1999/xlink"
3
		xmlns:teidocx="http://www.tei-c.org/ns/teidocx/1.0"
4
		xmlns:its="http://www.w3.org/2005/11/its"
5
                xmlns:html="http://www.w3.org/1999/xhtml"
6
                xmlns:dbk="http://docbook.org/ns/docbook"
7
                xmlns:rng="http://relaxng.org/ns/structure/1.0"
8
                xmlns:tei="http://www.tei-c.org/ns/1.0"
9
                xmlns:teix="http://www.tei-c.org/ns/Examples"
10
                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
11
                xmlns:fo="http://www.w3.org/1999/XSL/Format"
12
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
13
                exclude-result-prefixes="a fo dbk xlink rng tei html
14
					 teix its teidocx"
15
                version="2.0">
16
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
17
      <desc>
18
         <p> TEI stylesheet dealing with elements from the textstructure
19
      module, making HTML output. </p>
20
         <p>This software is dual-licensed:
21

    
22
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
23
Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
24

    
25
2. http://www.opensource.org/licenses/BSD-2-Clause
26
		
27
All rights reserved.
28

    
29
Redistribution and use in source and binary forms, with or without
30
modification, are permitted provided that the following conditions are
31
met:
32

    
33
* Redistributions of source code must retain the above copyright
34
notice, this list of conditions and the following disclaimer.
35

    
36
* Redistributions in binary form must reproduce the above copyright
37
notice, this list of conditions and the following disclaimer in the
38
documentation and/or other materials provided with the distribution.
39

    
40
This software is provided by the copyright holders and contributors
41
"as is" and any express or implied warranties, including, but not
42
limited to, the implied warranties of merchantability and fitness for
43
a particular purpose are disclaimed. In no event shall the copyright
44
holder or contributors be liable for any direct, indirect, incidental,
45
special, exemplary, or consequential damages (including, but not
46
limited to, procurement of substitute goods or services; loss of use,
47
data, or profits; or business interruption) however caused and on any
48
theory of liability, whether in contract, strict liability, or tort
49
(including negligence or otherwise) arising in any way out of the use
50
of this software, even if advised of the possibility of such damage.
51
</p>
52
         <p>Author: See AUTHORS</p>
53
         <p>Id: $Id: textstructure.xsl 10109 2012-02-22 12:18:38Z rahtz $</p>
54
         <p>Copyright: 2011, TEI Consortium</p>
55
      </desc>
56
   </doc>
57
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
58
      <desc>Process elements * in inner mode</desc>
59
   </doc>
60
  <xsl:template match="*" mode="innertext">
61
      <xsl:apply-templates select="."/>
62
  </xsl:template>
63
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
64
      <desc>Process elements * in paging mode</desc>
65
   </doc>
66
  <xsl:template match="*" mode="paging">
67
      <xsl:choose>
68
         <xsl:when test="self::tei:divGen[@type='summary']">
69
            <xsl:call-template name="summaryToc"/>
70
         </xsl:when>
71
         <xsl:when test="self::tei:divGen">
72
            <xsl:apply-templates select="."/>
73
         </xsl:when>
74
         <xsl:when test="starts-with(local-name(),'div')">
75
            <xsl:if test="not(preceding-sibling::tei:*) or preceding-sibling::tei:titlePage">
76
               <xsl:call-template name="doDivBody">
77
		 <xsl:with-param name="Depth">2</xsl:with-param>
78
		 <xsl:with-param name="nav">true</xsl:with-param>
79
	       </xsl:call-template>
80
            </xsl:if>
81
         </xsl:when>
82
         <xsl:when test="local-name(..)='front'">
83
            <xsl:apply-templates select="."/>
84
            <xsl:apply-templates mode="paging" select="following-sibling::*[1]"/>
85
            <xsl:apply-templates mode="paging" select="../../tei:body/*[1]"/>
86
         </xsl:when>
87
         <xsl:otherwise>
88
            <xsl:apply-templates select="."/>
89
            <xsl:apply-templates mode="paging" select="following-sibling::*[1]"/>
90
         </xsl:otherwise>
91
      </xsl:choose>
92
  </xsl:template>
93
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
94
      <desc>
95
         <p>Process root /</p>
96
	 <p xmlns="http://www.w3.org/1999/xhtml"> processors must support `key' </p>
97
      </desc>
98
   </doc>
99
  <xsl:template match="/">
100
    <xsl:call-template name="processTEI"/>
101
  </xsl:template>
102

    
103
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
104
      <desc>
105
         <p>Process top-level elements /</p>
106
      </desc>
107
   </doc>
108
   <xsl:template name="processTEI">
109
     <xsl:choose>
110
       <!-- there are various choices of how to proceed, driven by
111
	    
112
	    $pageLayout: Simple, CSS, Table
113
	    
114
	    $STDOUT: true or false
115
	    
116
	    $splitLevel: -1 to 3
117
	    
118
	    $requestedID: requests a particular page
119
       -->
120
       <!-- we are making a composite layout and there is a TEI or teiCorpus element -->
121
       <xsl:when test="($pageLayout = 'CSS' or $pageLayout = 'Table') and (tei:TEI or tei:teiCorpus)">
122
	 <xsl:if test="$verbose='true'">
123
	   <xsl:message>case 1: pageLayout <xsl:value-of select="$pageLayout"/>
124
	   </xsl:message>
125
	 </xsl:if>
126
	 <xsl:for-each select="tei:TEI|tei:teiCorpus">
127
	   <xsl:call-template name="doPageTable">
128
	     <xsl:with-param name="currentID" select="$requestedID"/>
129
	   </xsl:call-template>
130
	 </xsl:for-each>
131
	 <xsl:if test="$STDOUT='false'">
132
	   <xsl:call-template name="doDivs"/>
133
	 </xsl:if>
134
       </xsl:when>
135
       <!-- we have been asked for a particular section of the document -->
136
       <xsl:when test="not($requestedID='')">
137
	 <xsl:if test="$verbose='true'">
138
	   <xsl:message>case 3: ID <xsl:value-of select="$requestedID"/>, pageLayout
139
	   <xsl:value-of select="$pageLayout"/>
140
	   </xsl:message>
141
	 </xsl:if>
142
	 <xsl:choose>
143
	   <xsl:when test="$requestedID='prelim___'">
144
	     <xsl:apply-templates/>
145
	   </xsl:when>
146
	   <xsl:when test="count(id($requestedID))&gt;0">
147
	     <xsl:for-each select="id($requestedID)">
148
	       <xsl:call-template name="writeDiv"/>
149
	     </xsl:for-each>
150
	   </xsl:when>
151
	   <xsl:otherwise>
152
	     <!-- the passed ID is a pseudo-XPath expression
153
		  which starts below TEI/text.
154
		  The real XPath syntax is changed to avoid problems
155
	     -->
156
	     <xsl:apply-templates mode="xpath" select="tei:TEI/tei:text">
157
	       <xsl:with-param name="xpath" select="$requestedID"/>
158
	     </xsl:apply-templates>
159
	   </xsl:otherwise>
160
	 </xsl:choose>
161
       </xsl:when>
162
       <!-- we want HTML to just splurge out-->
163
       <xsl:when test="$STDOUT='true'">
164
	 <xsl:if test="$verbose='true'">
165
	   <xsl:message>case 4: write to stdout, pageLayout <xsl:value-of select="$pageLayout"/>
166
	   </xsl:message>
167
	 </xsl:if>
168
	 <xsl:apply-templates/>
169
       </xsl:when>
170
       <!-- we want the document split up into separate files -->
171
       <xsl:when test="tei:TEI or tei:teiCorpus and number($splitLevel)&gt;-1">
172
	 <xsl:if test="$verbose='true'">
173
	   <xsl:message>case 5: split output, <xsl:value-of select="$splitLevel"/> pageLayout <xsl:value-of select="$pageLayout"/>
174
	   </xsl:message>
175
	 </xsl:if>
176
	 <xsl:apply-templates mode="split"/>
177
       </xsl:when>
178
       <!-- we want the whole document, in an output file -->
179
       <xsl:otherwise>
180
	 <xsl:if test="$verbose='true'">
181
	   <xsl:message>case 6: one document, pageLayout <xsl:value-of select="$pageLayout"/>
182
	   </xsl:message>
183
	 </xsl:if>
184
	 <xsl:choose>
185
	   <xsl:when test="$masterFile='' or $STDOUT='true'">
186
	     <xsl:apply-templates/>
187
	   </xsl:when>
188
	   <xsl:otherwise>
189
	     
190
	     <xsl:variable name="outName">
191
	       <xsl:call-template name="outputChunkName">
192
		 <xsl:with-param name="ident">
193
		   <xsl:value-of select="$masterFile"/>
194
		 </xsl:with-param>
195
	       </xsl:call-template>
196
	     </xsl:variable>
197
	     
198
	     <xsl:if test="$verbose='true'">
199
	       <xsl:message>Opening file <xsl:value-of select="$outName"/>
200
	       </xsl:message>
201
	     </xsl:if>
202
	     <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}"
203
				  encoding="{$outputEncoding}"
204
				  href="{$outName}"
205
				  method="{$outputMethod}">
206
	       <xsl:apply-templates/>
207
	     </xsl:result-document>
208
	     
209
	     <xsl:if test="$verbose='true'">
210
	       <xsl:message>Closing file <xsl:value-of select="$outName"/>
211
	       </xsl:message>
212
	     </xsl:if>
213
	     
214
	   </xsl:otherwise>
215
	 </xsl:choose>
216
       </xsl:otherwise>
217
     </xsl:choose>
218
   </xsl:template>
219

    
220
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
221
      <desc>Process elements processing-instruction()[name()='xmltex']</desc>
222
   </doc>
223
  <xsl:template match="processing-instruction()[name()='xmltex']">
224
      <xsl:value-of select="."/>
225
  </xsl:template>
226
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
227
      <desc>Process element *</desc>
228
   </doc>
229
  <xsl:template match="tei:*" mode="generateNextLink">
230
      <span class="nextLink">
231
         <xsl:text> </xsl:text>
232
         <xsl:call-template name="i18n">
233
	           <xsl:with-param name="word">nextWord</xsl:with-param>
234
         </xsl:call-template>
235
         <xsl:call-template name="navInterSep"/>
236
      </span>
237
      <a class="navigation">
238
         <xsl:attribute name="href">
239
	           <xsl:apply-templates mode="generateLink" select="."/>
240
         </xsl:attribute>
241
         <xsl:call-template name="headerLink">
242
	           <xsl:with-param name="minimal" select="$minimalCrossRef"/>
243
         </xsl:call-template>
244
      </a>
245
  </xsl:template>
246

    
247
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
248
      <desc>Process elements looking for something to link to backwards</desc>
249
   </doc>
250
  <xsl:template match="tei:*" mode="generatePreviousLink">
251
      <span class="previousLink">
252
         <xsl:text> </xsl:text>
253
         <xsl:call-template name="i18n">
254
            <xsl:with-param name="word">previousWord</xsl:with-param>
255
         </xsl:call-template>
256
         <xsl:call-template name="navInterSep"/>
257
      </span>
258
      <a class="navigation">
259
         <xsl:attribute name="href">
260
            <xsl:apply-templates mode="generateLink" select="."/>
261
         </xsl:attribute>
262
         <xsl:call-template name="headerLink">
263
            <xsl:with-param name="minimal" select="$minimalCrossRef"/>
264
         </xsl:call-template>
265
      </a>
266
  </xsl:template>
267
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
268
      <desc>
269
         <p>Process any element in xpath mode</p>
270
         <p>
271
            <p xmlns="http://www.w3.org/1999/xhtml"> This nice bit of code is from Jeni Tennison </p>
272
         </p>
273
         <param name="xpath">xpath</param>
274
         <param name="action">action</param>
275
      </desc>
276
   </doc>
277
  <xsl:template match="tei:*" mode="xpath">
278
      <xsl:param name="xpath"/>
279
      <xsl:param name="action"/>
280
      <xsl:choose>
281
      <!-- if there is a path -->
282
      <xsl:when test="$xpath">
283
        <!-- step is the part before the '_' (if there is one) -->
284
        <xsl:variable name="step">
285
               <xsl:choose>
286
                  <xsl:when test="contains($xpath, '_')">
287
                     <xsl:value-of select="substring-before($xpath, '_')"/>
288
                  </xsl:when>
289
                  <xsl:otherwise>
290
                     <xsl:value-of select="$xpath"/>
291
                  </xsl:otherwise>
292
               </xsl:choose>
293
            </xsl:variable>
294
            <!-- the child's name is the part before the '.' -->
295
        <xsl:variable name="childName" select="substring-before($step, '.')"/>
296
            <!-- and its index is the part after '.' -->
297
        <xsl:variable name="childIndex" select="substring-after($step, '.')"/>
298
            <!-- so apply templates to that child, passing in the $xpath
299
	     left after the first step -->
300
        <xsl:apply-templates mode="xpath" select="*[name() = $childName]          [number($childIndex)]">
301
               <xsl:with-param name="xpath" select="substring-after($xpath, '_')"/>
302
               <xsl:with-param name="action" select="$action"/>
303
            </xsl:apply-templates>
304
         </xsl:when>
305
         <!-- if there's no path left, then this is the element we want -->
306
      <xsl:otherwise>
307
            <xsl:choose>
308
               <xsl:when test="$action='header'">
309
                  <xsl:apply-templates mode="xref" select="."/>
310
               </xsl:when>
311
               <xsl:when test="$action='notes'">
312
                  <xsl:call-template name="printNotes"/>
313
               </xsl:when>
314
               <xsl:when test="$action='toclist'">
315
                  <xsl:call-template name="linkListContents">
316
                     <xsl:with-param name="style" select="'toclist'"/>
317
                  </xsl:call-template>
318
               </xsl:when>
319
               <xsl:when test="starts-with(local-name(),'div') and      $pageLayout='Table'      or      $pageLayout='CSS'">
320
                  <xsl:call-template name="doDivBody">
321
		    <xsl:with-param name="Depth">2</xsl:with-param>
322
		    <xsl:with-param name="nav">true</xsl:with-param>
323
		  </xsl:call-template>
324
               </xsl:when>
325
               <xsl:when test="self::tei:divGen[@type='summary']">
326
                  <xsl:call-template name="summaryToc"/>
327
               </xsl:when>
328
               <xsl:otherwise>
329
                  <html>
330
                     <xsl:call-template name="addLangAtt"/>
331
                     <xsl:call-template name="htmlFileTop"/>
332
		     <body id="TOP">
333
                        <xsl:call-template name="bodyMicroData"/>
334
                        <xsl:call-template name="bodyJavascriptHook"/>
335
			<xsl:call-template name="bodyHook"/>
336
			<div class="stdheader">
337
			  <xsl:call-template name="stdheader">
338
			    <xsl:with-param name="title">
339
			      <xsl:call-template name="generateTitle"/>
340
                              </xsl:with-param>
341
			  </xsl:call-template>
342
			</div>
343
                        <h2>
344
                           <xsl:apply-templates mode="xref" select="."/>
345
			   <xsl:call-template name="sectionHeadHook"/>
346
                        </h2>
347
                        <xsl:apply-templates/>
348
                        <xsl:call-template name="printNotes"/>
349
                        <xsl:call-template name="htmlFileBottom"/>
350
			<xsl:call-template name="bodyEndHook"/>
351
		     </body>
352
		  </html>
353
               </xsl:otherwise>
354
            </xsl:choose>
355
         </xsl:otherwise>
356
      </xsl:choose>
357
  </xsl:template>
358
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
359
      <desc>
360
         <p>Process root element TEI</p>
361
      </desc>
362
   </doc>
363
  <xsl:template match="tei:TEI">
364
      <xsl:call-template name="teiStartHook"/>
365
      <xsl:if test="$verbose='true'">
366
         <xsl:message>TEI HTML in single document mode </xsl:message>
367
      </xsl:if>
368
      <html>
369
         <xsl:call-template name="addLangAtt"/>
370
         <head>
371
            <xsl:variable name="pagetitle">
372
               <xsl:call-template name="generateTitle"/>
373
            </xsl:variable>
374
            <title>
375
               <xsl:value-of select="$pagetitle"/>
376
            </title>
377
            <xsl:call-template name="headHook"/>
378
            <xsl:call-template name="metaHTML">
379
               <xsl:with-param name="title" select="$pagetitle"/>
380
            </xsl:call-template>
381
            <xsl:call-template name="includeCSS"/>
382
            <xsl:call-template name="cssHook"/>
383
            <xsl:call-template name="includeJavascript"/>
384
            <xsl:call-template name="javascriptHook"/>
385
         </head>
386
         <body class="simple" id="TOP">
387
            <xsl:call-template name="bodyMicroData"/>
388
            <xsl:call-template name="bodyJavascriptHook"/>
389
	    <xsl:call-template name="bodyHook"/>
390
            <xsl:if test="not(tei:text/tei:front/tei:titlePage)">
391
	      <div class="stdheader">
392
		<xsl:call-template name="stdheader">
393
		  <xsl:with-param name="title">
394
		    <xsl:call-template name="generateTitle"/>
395
		  </xsl:with-param>
396
		</xsl:call-template>
397
	      </div>
398
            </xsl:if>
399
            <xsl:call-template name="startHook"/>
400
            <xsl:call-template name="simpleBody"/>
401
            <xsl:call-template name="stdfooter"/>
402
            <xsl:call-template name="bodyEndHook"/>
403
         </body>
404
      </html>
405
      <xsl:if test="$verbose='true'">
406
         <xsl:message>TEI HTML: run end hook template teiEndHook</xsl:message>
407
      </xsl:if>
408
      <xsl:call-template name="teiEndHook"/>
409
  </xsl:template>
410
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
411
      <desc>
412
         <p>Process root element TEI in splitting mode</p>
413
      </desc>
414
   </doc>
415
  <xsl:template match="tei:TEI" mode="split">
416
      <xsl:variable name="BaseFile">
417
         <xsl:value-of select="$masterFile"/>
418
         <xsl:call-template name="addCorpusID"/>
419
      </xsl:variable>
420
      <xsl:if test="$verbose='true'">
421
         <xsl:message>TEI HTML: run start hook template teiStartHook</xsl:message>
422
      </xsl:if>
423
      <xsl:call-template name="teiStartHook"/>
424
      <xsl:if test="$verbose='true'">
425
         <xsl:message>TEI HTML in splitting mode, base file is <xsl:value-of select="$BaseFile"/>
426
         </xsl:message>
427
      </xsl:if>
428

    
429
      <xsl:variable name="outName">
430
         <xsl:call-template name="outputChunkName">
431
	           <xsl:with-param name="ident">
432
	              <xsl:choose>
433
	                 <xsl:when test="parent::tei:teiCorpus">
434
	                    <xsl:apply-templates select="." mode="ident"/>
435
	                 </xsl:when>
436
	                 <xsl:otherwise>
437
	                    <xsl:value-of select="$BaseFile"/>
438
	                 </xsl:otherwise>
439
	              </xsl:choose>
440
	           </xsl:with-param>
441
         </xsl:call-template>
442
      </xsl:variable>
443
    
444
      <xsl:if test="$verbose='true'">
445
         <xsl:message>Opening file <xsl:value-of select="$outName"/>
446
         </xsl:message>
447
      </xsl:if>
448
      <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}"
449
                           encoding="{$outputEncoding}"
450
                           href="{$outName}"
451
                           method="{$outputMethod}">
452
    
453
        <xsl:call-template name="pageLayoutSimple"/>
454
      </xsl:result-document>
455
    
456
      <xsl:if test="$verbose='true'">
457
         <xsl:message>Closing file <xsl:value-of select="$outName"/>
458
         </xsl:message>
459
      </xsl:if>
460

    
461
      <xsl:if test="$verbose='true'">
462
         <xsl:message>TEI HTML: run end hook template teiEndHook</xsl:message>
463
      </xsl:if>
464
      <xsl:call-template name="teiEndHook"/>
465
  </xsl:template>
466
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
467
      <desc>Process elements front, body or back in splitting mode</desc>
468
   </doc>
469
  <xsl:template match="tei:front|tei:body|tei:back" mode="split">
470
      <xsl:for-each select="*">
471
         <xsl:choose>
472
            <xsl:when test="starts-with(local-name(.),'div')">
473
               <xsl:apply-templates mode="split" select="."/>
474
            </xsl:when>
475
            <xsl:otherwise>
476
               <xsl:apply-templates select="."/>
477
            </xsl:otherwise>
478
         </xsl:choose>
479
      </xsl:for-each>
480
  </xsl:template>
481
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
482
      <desc>Process element body in inner mode</desc>
483
   </doc>
484
  <xsl:template match="tei:body" mode="inner">
485
      <xsl:apply-templates/>
486
  </xsl:template>
487
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
488
      <desc>Process element closer</desc>
489
   </doc>
490
  <xsl:template match="tei:closer">
491
	<xsl:choose>
492
	  <xsl:when test="tei:signed">
493
	    <div class="closer">
494
	      <xsl:apply-templates/>
495
	    </div>
496
	  </xsl:when>
497
	  <xsl:when test="tei:postscript">
498
	    <div class="closer">
499
	      <xsl:apply-templates/>
500
	    </div>
501
	  </xsl:when>
502
	  <xsl:when test="tei:p">
503
	    <blockquote class="closer">
504
	      <xsl:apply-templates/>
505
	    </blockquote>
506
	  </xsl:when>
507
	  <xsl:otherwise>
508
	    <blockquote class="closer">
509
	      <p>
510
		<xsl:apply-templates/>
511
	      </p>
512
	    </blockquote>
513
	  </xsl:otherwise>
514
	</xsl:choose>
515
  </xsl:template>
516
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
517
      <desc>Process element dateline</desc>
518
   </doc>
519
  <xsl:template match="tei:dateline">
520
      <span class="dateline">
521
         <xsl:apply-templates/>
522
      </span>
523
  </xsl:template>
524
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
525
      <desc>Process element divGen[@type='actions']</desc>
526
   </doc>
527
  <xsl:template match="tei:divGen[@type='actions']">
528
      <h3>Actions arising</h3>
529
      <dl>
530
         <xsl:for-each select="/tei:TEI/tei:text//tei:note[@type='action']">
531
            <dt>
532
               <b>
533
                  <xsl:number count="tei:note[@type='action']" level="any"/>
534
               </b>
535
            </dt>
536
            <dd>
537
               <xsl:apply-templates/>
538
            </dd>
539
         </xsl:for-each>
540
      </dl>
541
  </xsl:template>
542
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
543
      <desc>
544
         <p>Process element divGen[@type='toc']</p>
545
         <p>
546
            <p xmlns="http://www.w3.org/1999/xhtml"> table of contents </p>
547
         </p>
548
      </desc>
549
   </doc>
550
  <xsl:template match="tei:divGen[@type='toc']">
551
    <div class="tei_toc">
552
      <h2>
553
         <xsl:call-template name="i18n">
554
            <xsl:with-param name="word">tocWords</xsl:with-param>
555
         </xsl:call-template>
556
      </h2>
557
      <xsl:call-template name="mainTOC"/>
558
    </div>
559
  </xsl:template>
560

    
561
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
562
      <desc>
563
         <p>index element, by default does nothing, unless it has an xml:id</p>
564
      </desc>
565
   </doc>
566
  <xsl:template match="tei:index">
567
    <xsl:if test="@xml:id">
568
      <span>
569
	<xsl:attribute name="id" select="@xml:id"/>
570
	<span style="display:none">
571
	  <xsl:value-of select="normalize-space(tei:term)"/>
572
	</span>
573
      </span>
574
    </xsl:if>
575
  </xsl:template>
576

    
577
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
578
      <desc>
579
         <p>Simplistic processing of element divGen[@type='index']</p>
580
         <p>
581
            <p xmlns="http://www.w3.org/1999/xhtml">make an index;
582
	    does not take indexName or nested index into account </p>
583
         </p>
584
      </desc>
585
   </doc>
586
  <xsl:template match="tei:divGen[@type='index']">
587
    <div class="tei_index">
588
      <h2>Index</h2>
589
      <xsl:variable name="index">
590
	<xsl:for-each select="key('INDEX',1)">
591
	  <tei:REF>
592
	    <tei:SORT>
593
	      <xsl:value-of select="lower-case(normalize-unicode(tei:term,'NFD'))"/>
594
	    </tei:SORT>	    
595
	    <tei:TERM>
596
	      <xsl:value-of select="tei:term"/>
597
	    </tei:TERM>	    
598
	    <xsl:for-each select="ancestor-or-self::*[tei:is-identifiable(.)][1]">
599
	      <tei:LINK>
600
		  <xsl:apply-templates mode="generateLink"
601
				       select="."/>
602
	      </tei:LINK>
603
	      <tei:TARGET>
604
		<xsl:call-template name="header"/>
605
	      </tei:TARGET>
606
	    </xsl:for-each>
607
	  </tei:REF>
608
	</xsl:for-each>
609
      </xsl:variable>
610
      <dl>
611
	<xsl:for-each-group select="$index/tei:REF" group-by="tei:TERM">
612
	  <xsl:sort select="tei:SORT" lang="{$doclang}"/>
613
	  <dt><xsl:value-of select="current-grouping-key()"/></dt>
614
	  <dd>
615
	    <xsl:for-each-group select="current-group()" group-by="tei:LINK">
616
	      <xsl:for-each select="current-group()[1]">
617
		<a href="{tei:LINK}">
618
		  <xsl:value-of select="tei:TARGET"/>
619
		</a>
620
	      </xsl:for-each>
621
	      <xsl:value-of select="$spaceCharacter"/>
622
	    </xsl:for-each-group>
623
	  </dd>
624
	</xsl:for-each-group>
625
      </dl>
626
    </div>
627
  </xsl:template>
628

    
629
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
630
    <desc>Process elements
631
      tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6</desc>
632
   </doc>
633
  <xsl:template match="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
634
      <xsl:variable name="depth">
635
         <xsl:apply-templates mode="depth" select="."/>
636
      </xsl:variable>
637
      <!-- depending on depth and splitting level, 
638
	 we may do one of two things: -->
639
    <xsl:choose>
640
      <!-- -1. Override at top level -->
641
      <xsl:when test="ancestor::tei:floatingText">
642
	  <xsl:call-template name="doDivBody">
643
	    <xsl:with-param name="Depth" select="$depth"/>
644
	  </xsl:call-template>
645
      </xsl:when>
646
      <xsl:when test="ancestor::tei:TEI/@rend='all'">
647
	  <xsl:call-template name="doDivBody">
648
	    <xsl:with-param name="Depth" select="$depth"/>
649
	  </xsl:call-template>
650
      </xsl:when>
651
      <xsl:when test="ancestor::tei:TEI/@rend='frontpage'">
652
	  <xsl:call-template name="doDivBody">
653
	    <xsl:with-param name="Depth" select="$depth"/>
654
	  </xsl:call-template>
655
      </xsl:when>
656
      <!-- 0. We have gone far enough -->
657
      <xsl:when test="$depth = $splitLevel and $STDOUT='true'">
658
      </xsl:when>
659
      <!-- 1. our section depth is below the splitting level -->
660
      <xsl:when test="number($depth) &gt; number($splitLevel) or         @rend='nosplit' or ancestor::tei:TEI/@rend='all' or         ancestor::tei:TEI/@rend='frontpage' or         ancestor::tei:TEI/@rend='nosplit'">
661
	  <xsl:call-template name="doDivBody">
662
	    <xsl:with-param name="Depth" select="$depth"/>
663
	  </xsl:call-template>
664
      </xsl:when>
665
      <!-- 2. we are at or above splitting level, 
666
	   so start a new page  -->
667
      <xsl:when test="number($depth) &lt;= number($splitLevel) and ancestor::tei:front and $splitFrontmatter='true'">
668
	<xsl:call-template name="makeDivPage">
669
	  <xsl:with-param name="depth" select="$depth"/>
670
	</xsl:call-template>
671
      </xsl:when>
672
      <xsl:when test="number($depth) &lt;= number($splitLevel) and ancestor::tei:back and $splitBackmatter='true'">
673
	<xsl:call-template name="makeDivPage">
674
	  <xsl:with-param name="depth" select="$depth"/>
675
	</xsl:call-template>
676
      </xsl:when>
677
      <xsl:when test="number($depth) &lt;= number($splitLevel) and ancestor::tei:body">
678
	<xsl:call-template name="makeDivPage">
679
	  <xsl:with-param name="depth" select="$depth"/>
680
	</xsl:call-template>
681
      </xsl:when>
682
      <xsl:otherwise>
683
	  <xsl:call-template name="doDivBody">
684
	    <xsl:with-param name="Depth" select="$depth"/>
685
	  </xsl:call-template>
686
      </xsl:otherwise>
687
    </xsl:choose>
688
  </xsl:template>
689

    
690
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
691
      <desc>Create a new output page for a section
692
      <param name="depth">depth of section (1, 2 3, 4 etc)</param>
693
      </desc>
694
   </doc>
695
  <xsl:template name="makeDivPage">
696
      <xsl:param name="depth"/>
697
      <xsl:variable name="outName">
698
	<xsl:call-template name="outputChunkName">
699
	  <xsl:with-param name="ident">
700
	    <xsl:apply-templates mode="ident" select="."/>
701
	  </xsl:with-param>
702
	</xsl:call-template>
703
      </xsl:variable>
704
      
705
      <xsl:if test="$verbose='true'">
706
	<xsl:message>Opening file <xsl:value-of select="$outName"/>
707
	</xsl:message>
708
      </xsl:if>
709
      <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}"
710
			   encoding="{$outputEncoding}"
711
			   href="{$outName}"
712
			   method="{$outputMethod}">	     
713
	<xsl:choose>
714
	  <xsl:when test="$pageLayout='CSS'">
715
	    <xsl:call-template name="pageLayoutCSS">
716
	      <xsl:with-param name="currentID">
717
		<xsl:apply-templates mode="ident" select="."/>
718
	      </xsl:with-param>
719
	    </xsl:call-template>
720
	  </xsl:when>
721
	  <xsl:when test="$pageLayout='Table'">
722
	    <xsl:call-template name="pageLayoutTable">
723
	      <xsl:with-param name="currentID">
724
		<xsl:apply-templates mode="ident" select="."/>
725
	      </xsl:with-param>
726
	    </xsl:call-template>
727
	  </xsl:when>
728
	  <xsl:otherwise>
729
	    <xsl:call-template name="writeDiv"/>
730
	  </xsl:otherwise>
731
	</xsl:choose>
732
	
733
      </xsl:result-document>
734
      
735
      <xsl:if test="$verbose='true'">
736
	<xsl:message>Closing file <xsl:value-of select="$outName"/>
737
	</xsl:message>
738
      </xsl:if>
739
  </xsl:template>
740
  
741
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
742
      <desc>Process element docAuthor in "author" mode"</desc>
743
   </doc>
744
  <xsl:template match="tei:docAuthor" mode="author">
745
      <xsl:if test="preceding-sibling::tei:docAuthor">
746
         <xsl:text>, </xsl:text>
747
      </xsl:if>
748
      <xsl:apply-templates/>
749
  </xsl:template>
750

    
751
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
752
      <desc>
753
         <p>Process element docTitle, docAuthor, docImprint and
754
	 tei:docDate</p>
755
         <p>
756
            <p xmlns="http://www.w3.org/1999/xhtml"> Translate these to a corresponding HTML div </p>
757
         </p>
758
      </desc>
759
   </doc>
760
  <xsl:template match="tei:docTitle|tei:docAuthor|tei:docImprint|tei:titlePage/tei:titlePart|tei:docDate">
761
    <xsl:variable name="container">
762
      <xsl:choose>
763
	<xsl:when test="parent::tei:titlePage">
764
	 <xsl:text>div</xsl:text>
765
	</xsl:when>
766
	<xsl:otherwise>
767
	 <xsl:text>span</xsl:text>
768
	</xsl:otherwise>
769
      </xsl:choose>
770
    </xsl:variable>
771
    <xsl:element name="{$container}">
772
      <xsl:call-template name="microdata"/>
773
      <xsl:choose>
774
	<xsl:when test="@rendition">
775
	  <xsl:call-template name="applyRendition"/>
776
	</xsl:when>
777
	<xsl:otherwise>
778
	  <xsl:call-template name="rendToClass">
779
	    <xsl:with-param name="default">
780
	      <xsl:value-of select="local-name()"/>
781
	    </xsl:with-param>
782
	  </xsl:call-template>
783
	</xsl:otherwise>
784
      </xsl:choose>
785
      <xsl:apply-templates/>
786
    </xsl:element>
787
  </xsl:template>
788

    
789

    
790
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
791
      <desc>Process element opener</desc>
792
   </doc>
793

    
794
  <xsl:template match="tei:opener">
795
    <xsl:choose>
796
      <xsl:when test="tei:signed|tei:salute">
797
	<div class="opener">
798
	  <xsl:apply-templates/>
799
	</div>
800
      </xsl:when>
801
      <xsl:when test="tei:p">
802
	<blockquote class="opener">
803
	  <xsl:apply-templates/>
804
	</blockquote>
805
      </xsl:when>
806
      <xsl:otherwise>
807
	<blockquote class="opener">
808
	  <p>
809
	    <xsl:apply-templates/>
810
	  </p>
811
	</blockquote>
812
      </xsl:otherwise>
813
    </xsl:choose>
814
  </xsl:template>
815

    
816
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
817
      <desc>Process element text</desc>
818
   </doc>
819
  <xsl:template match="tei:text">
820
      <xsl:choose>
821
         <xsl:when test="parent::tei:TEI">
822
            <xsl:apply-templates/>
823
         </xsl:when>
824
         <xsl:when test="ancestor::tei:group and $splitLevel=0">
825
	   <xsl:call-template name="makeDivPage">
826
	     <xsl:with-param name="depth">-1</xsl:with-param>
827
	   </xsl:call-template>
828
         </xsl:when>
829
	 <xsl:otherwise>
830
	   <xsl:call-template name="doDivBody"/>
831
	 </xsl:otherwise>
832
      </xsl:choose>
833
  </xsl:template>
834

    
835
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
836
      <desc>Process element titlePage</desc>
837
   </doc>
838
  <xsl:template match="tei:titlePage">
839
      <div class="titlePage">
840
         <xsl:apply-templates/>
841
      </div>
842
  </xsl:template>
843
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
844
      <desc>[html] <param name="crumbBody">crumbBody</param>
845
      </desc>
846
   </doc>
847
  <xsl:template name="aCrumb">
848
      <xsl:param name="crumbBody"/>
849
      <li class="breadcrumb">
850
         <xsl:copy-of select="$crumbBody"/>
851
      </li>
852
  </xsl:template>
853
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
854
      <desc>[html] </desc>
855
   </doc>
856
  <xsl:template name="addCorpusID">
857
      <xsl:if test="ancestor-or-self::tei:teiCorpus">
858
         <xsl:for-each select="ancestor-or-self::tei:TEI">
859
            <xsl:text>-</xsl:text>
860
            <xsl:choose>
861
               <xsl:when test="@xml:id">
862
                  <xsl:value-of select="@xml:id"/>
863
               </xsl:when>
864
               <xsl:otherwise>
865
                  <xsl:number/>
866
               </xsl:otherwise>
867
            </xsl:choose>
868
         </xsl:for-each>
869
      </xsl:if>
870
  </xsl:template>
871
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
872
      <desc>[html] </desc>
873
   </doc>
874
  <xsl:template name="addLangAtt">
875
      <xsl:variable name="documentationLanguage">
876
         <xsl:choose>
877
            <xsl:when test="string-length($doclang)&gt;0">
878
	      <xsl:value-of select="$doclang"/>
879
            </xsl:when>
880
            <xsl:when test="ancestor-or-self::tei:schemaSpec/@docLang">
881
	      <xsl:value-of select="//tei:schemaSpec[1]/@docLang"/>
882
            </xsl:when>
883
            <xsl:otherwise>
884
	      <xsl:text>en</xsl:text>
885
            </xsl:otherwise>
886
         </xsl:choose>
887
      </xsl:variable>
888

    
889
      <xsl:variable name="supplied">
890
	<xsl:choose>
891
	  <xsl:when test="ancestor-or-self::tei:*[@xml:lang]">
892
	    <xsl:value-of select="ancestor-or-self::tei:*[@xml:lang][1]/@xml:lang"/>
893
	  </xsl:when>
894
	  <xsl:when test="ancestor-or-self::tei:*[@lang]">
895
	    <xsl:value-of select="ancestor-or-self::tei:*[@lang][1]/@lang"/>
896
	  </xsl:when>
897
	  <xsl:otherwise>
898
	    <xsl:value-of select="$documentationLanguage"/>
899
	  </xsl:otherwise>
900
	</xsl:choose>
901
      </xsl:variable>
902
      <xsl:choose>
903
	<xsl:when test="$outputTarget='html'">
904
	  <xsl:attribute name="xml:lang">
905
	    <xsl:value-of select="$supplied"/>
906
	  </xsl:attribute>
907
	</xsl:when>
908
	<xsl:when test="$outputTarget='html5'">
909
	  <xsl:attribute name="lang">
910
	    <xsl:value-of select="$supplied"/>
911
	  </xsl:attribute>
912
	</xsl:when>
913
      </xsl:choose>
914
  </xsl:template>
915
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
916
      <desc>
917
         <p>[html] </p>
918
         <p>where to start the path from</p>
919
         <param name="crumbRoot">/</param>
920
      </desc>
921
   </doc>
922
  <xsl:template name="crumbPath">
923
      <xsl:param name="crumbRoot">/</xsl:param>
924
      <div class="breadcrumb">
925
         <xsl:call-template name="preBreadCrumbPath"/>
926
         <ul class="breadcrumb">
927
            <li class="breadcrumb-first">
928
               <a class="breadcrumb" href="{$homeURL}">
929
                  <xsl:value-of select="$homeLabel"/>
930
               </a>
931
            </li>
932
            <xsl:call-template name="walkTree">
933
               <xsl:with-param name="path">
934
                  <xsl:value-of select="substring-after($REQUEST,$crumbRoot)"/>
935
               </xsl:with-param>
936
               <xsl:with-param name="whole">
937
                  <xsl:value-of select="$crumbRoot"/>
938
               </xsl:with-param>
939
               <xsl:with-param name="class">breadcrumb</xsl:with-param>
940
            </xsl:call-template>
941
         </ul>
942
      </div>
943
  </xsl:template>
944

    
945
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
946
      <desc>[html] Make a section heading
947
      <param name="Depth">which head level to make</param>
948
      </desc>
949
   </doc>
950
  <xsl:template name="doDivBody">
951
      <xsl:param name="Depth"/>
952
      <xsl:param name="nav">false</xsl:param>
953
      <xsl:variable name="container">
954
	<xsl:choose>
955
	  <xsl:when test="$outputTarget='html5'">section</xsl:when>
956
	  <xsl:otherwise>div</xsl:otherwise>
957
	</xsl:choose>
958
      </xsl:variable>
959
      <xsl:choose>
960
	<xsl:when test="$filePerPage='true'">
961
	    <xsl:call-template name="startDivHook"/>
962
	    <xsl:call-template name="divContents">
963
	      <xsl:with-param name="Depth" select="$Depth"/>
964
	      <xsl:with-param name="nav" select="$nav"/>
965
	    </xsl:call-template>
966
	</xsl:when>
967
	<xsl:otherwise>
968
	  <xsl:element name="{$container}">
969
	    <xsl:call-template name="microdata"/>
970
	    <xsl:call-template name="divClassAttribute">
971
	      <xsl:with-param name="depth" select="$Depth"/>
972
	    </xsl:call-template>	
973
	    <xsl:call-template name="startDivHook"/>
974
	    <xsl:call-template name="divContents">
975
	      <xsl:with-param name="Depth" select="$Depth"/>
976
	      <xsl:with-param name="nav" select="$nav"/>
977
	    </xsl:call-template>
978
	  </xsl:element>
979
	</xsl:otherwise>
980
      </xsl:choose>
981
  </xsl:template>
982

    
983
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
984
      <desc>[html] doing the contents of a div</desc>
985
   </doc>
986

    
987
  <xsl:template name="divContents">
988
      <xsl:param name="Depth"/>
989
      <xsl:param name="nav">false</xsl:param>
990
      <xsl:variable name="ident">
991
	<xsl:apply-templates mode="ident" select="."/>
992
      </xsl:variable>
993
      
994
	<xsl:choose>
995
	  <xsl:when test="parent::tei:*/@rend='multicol'">
996
	    <td style="vertical-align:top;">
997
	      <xsl:if test="not($Depth = '')">
998
		<xsl:element name="h{$Depth + $divOffset}">
999
		  <xsl:for-each select="tei:head[1]">		
1000
		    <xsl:call-template name="rendToClass">
1001
		      <xsl:with-param name="default"/>
1002
		    </xsl:call-template>
1003
		 </xsl:for-each>
1004
		 <xsl:call-template name="header">
1005
		   <xsl:with-param name="display">full</xsl:with-param>
1006
		 </xsl:call-template>
1007
		 <xsl:call-template name="sectionHeadHook"/>
1008
	       </xsl:element>
1009
	     </xsl:if>
1010
	     <xsl:apply-templates/>
1011
	   </td>
1012
         </xsl:when>
1013
         <xsl:when test="@rend='multicol'">
1014
            <xsl:apply-templates select="*[not(local-name(.)='div')]"/>
1015
            <table>
1016
               <tr>
1017
                  <xsl:apply-templates select="tei:div"/>
1018
               </tr>
1019
            </table>
1020
         </xsl:when>
1021
	 <xsl:when test="@rend='nohead'">
1022
	   <xsl:apply-templates/>
1023
	 </xsl:when>
1024
         <xsl:otherwise>
1025
	   <xsl:if test="not($Depth = '')">
1026
	     <xsl:variable name="Heading">
1027
	       <xsl:element name="{if (number($Depth)+$divOffset &gt;6) then 'div'
1028
				  else concat('h',number($Depth) + $divOffset)}">
1029
		 <xsl:choose>
1030
		   <xsl:when test="@rend">
1031
		     <xsl:call-template name="rendToClass">
1032
		       <xsl:with-param
1033
			   name="id">false</xsl:with-param>
1034
		     </xsl:call-template>
1035
		   </xsl:when>
1036
		   <xsl:otherwise>
1037
		     <xsl:for-each select="tei:head[1]">
1038
		       <xsl:call-template name="rendToClass">
1039
			 <xsl:with-param name="default">
1040
			   <xsl:if test="number($Depth)&gt;5">
1041
			     <xsl:text>div</xsl:text>
1042
			     <xsl:value-of select="$Depth"/>
1043
			   </xsl:if>
1044
			 </xsl:with-param>
1045
		       </xsl:call-template>
1046
		     </xsl:for-each>
1047
		   </xsl:otherwise>
1048
		 </xsl:choose>
1049
		 <xsl:call-template name="header">
1050
		   <xsl:with-param name="display">full</xsl:with-param>
1051
		 </xsl:call-template>
1052
		 <xsl:call-template name="sectionHeadHook"/>
1053
	       </xsl:element>
1054
	     </xsl:variable>
1055
	     <xsl:choose>
1056
	       <xsl:when test="$outputTarget='html5'">
1057
		 <header>
1058
		   <xsl:copy-of select="$Heading"/>
1059
		 </header>
1060
	       </xsl:when>
1061
	       <xsl:otherwise>
1062
		 <xsl:copy-of select="$Heading"/>
1063
	       </xsl:otherwise>
1064
	     </xsl:choose>
1065

    
1066
	     <xsl:if test="$topNavigationPanel='true' and
1067
			   $nav='true'">
1068
	       <xsl:element name="{if ($outputTarget='html5') then 'nav'
1069
				  else 'div'}">
1070
		 <xsl:call-template name="xrefpanel">
1071
		   <xsl:with-param name="homepage" select="concat($masterFile,$standardSuffix)"/>
1072
		   <xsl:with-param name="mode" select="local-name(.)"/>
1073
		 </xsl:call-template>
1074
	       </xsl:element>
1075
	     </xsl:if>
1076
	   </xsl:if>
1077
	   <xsl:apply-templates/>
1078
	   <xsl:if test="$bottomNavigationPanel='true' and
1079
			 $nav='true'">
1080
	     <xsl:element name="{if ($outputTarget='html5') then 'nav' else
1081
				'div'}">	       
1082
	       <xsl:call-template name="xrefpanel">
1083
		 <xsl:with-param name="homepage" select="concat($masterFile,$standardSuffix)"/>
1084
		 <xsl:with-param name="mode" select="local-name(.)"/>
1085
	       </xsl:call-template>
1086
	     </xsl:element>
1087
	   </xsl:if>
1088
         </xsl:otherwise>
1089
	</xsl:choose>
1090
  </xsl:template>
1091

    
1092
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1093
      <desc>[html] process divisions</desc>
1094
   </doc>
1095
  <xsl:template name="doDivs">
1096
      <xsl:for-each select="tei:TEI/tei:text">
1097
         <xsl:for-each select="tei:front|tei:body|tei:back">
1098
            <xsl:for-each select="tei:div|tei:div1">
1099
               <xsl:variable name="currentID">
1100
                  <xsl:apply-templates mode="ident" select="."/>
1101
               </xsl:variable>
1102
               <xsl:call-template name="doPageTable">
1103
                  <xsl:with-param name="currentID" select="$currentID"/>
1104
               </xsl:call-template>
1105
            </xsl:for-each>
1106
         </xsl:for-each>
1107
      </xsl:for-each>
1108
  </xsl:template>
1109
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1110
      <desc>[html] <param name="currentID">currentID</param>
1111
      </desc>
1112
   </doc>
1113
  <xsl:template name="doPageTable">
1114
      <xsl:param name="currentID"/>
1115
      <xsl:variable name="BaseFile">
1116
         <xsl:value-of select="$masterFile"/>
1117
         <xsl:call-template name="addCorpusID"/>
1118
      </xsl:variable>
1119
      <xsl:choose>
1120
         <xsl:when test="$STDOUT='true'">
1121
	           <xsl:choose>
1122
	              <xsl:when test="$pageLayout='CSS'">
1123
                  <xsl:call-template name="pageLayoutCSS">
1124
                     <xsl:with-param name="currentID" select="$currentID"/>
1125
                  </xsl:call-template>
1126
               </xsl:when>
1127
               <xsl:when test="$pageLayout='Table'">
1128
                  <xsl:call-template name="pageLayoutTable">
1129
                     <xsl:with-param name="currentID" select="$currentID"/>
1130
                  </xsl:call-template>
1131
               </xsl:when>
1132
            </xsl:choose>
1133
         </xsl:when>
1134
         <xsl:otherwise>
1135

    
1136

    
1137
	           <xsl:variable name="outName">
1138
	              <xsl:call-template name="outputChunkName">
1139
	                 <xsl:with-param name="ident">
1140
	                    <xsl:choose>
1141
		                      <xsl:when test="not($currentID='')">
1142
		                         <xsl:value-of select="$currentID"/>
1143
		                      </xsl:when>
1144
		                      <xsl:otherwise>
1145
		                         <xsl:value-of select="$BaseFile"/>
1146
	                       </xsl:otherwise>
1147
	                    </xsl:choose>
1148
	                 </xsl:with-param>
1149
	              </xsl:call-template>
1150
	           </xsl:variable>
1151
	
1152
	           <xsl:if test="$verbose='true'">
1153
	              <xsl:message>Opening file <xsl:value-of select="$outName"/>
1154
               </xsl:message>
1155
	           </xsl:if>
1156
	           <xsl:result-document doctype-public="{$doctypePublic}" doctype-system="{$doctypeSystem}"
1157
                                 encoding="{$outputEncoding}"
1158
                                 href="{$outName}"
1159
                                 method="{$outputMethod}">
1160
	              <xsl:choose>
1161
	                 <xsl:when test="$pageLayout='CSS'">
1162
		                   <xsl:call-template name="pageLayoutCSS">
1163
		                      <xsl:with-param name="currentID" select="$currentID"/>
1164
		                   </xsl:call-template>
1165
	                 </xsl:when>
1166
	                 <xsl:when test="$pageLayout='Table'">
1167
		                   <xsl:call-template name="pageLayoutTable">
1168
		                      <xsl:with-param name="currentID" select="$currentID"/>
1169
		                   </xsl:call-template>
1170
	                 </xsl:when>
1171
	              </xsl:choose>
1172
	           </xsl:result-document>
1173
	
1174
	           <xsl:if test="$verbose='true'">
1175
	              <xsl:message>Closing file <xsl:value-of select="$outName"/>
1176
               </xsl:message>
1177
	           </xsl:if>
1178
         </xsl:otherwise>
1179
      </xsl:choose>
1180
  </xsl:template>
1181

    
1182
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1183
      <desc>plain text version of title for div [html] </desc>
1184
   </doc>
1185
  <xsl:template name="generateDivtitle">
1186
      <xsl:apply-templates select="tei:head" mode="plain"/>
1187
  </xsl:template>
1188

    
1189
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1190
      <desc>link to level above[html] </desc>
1191
   </doc>
1192
  <xsl:template name="generateUpLink">
1193
      <xsl:variable name="myName">
1194
         <xsl:value-of select="local-name(.)"/>
1195
      </xsl:variable>
1196
      <xsl:variable name="BaseFile">
1197
         <xsl:value-of select="$masterFile"/>
1198
         <xsl:value-of select="$standardSuffix"/>
1199
         <xsl:call-template name="addCorpusID"/>
1200
      </xsl:variable>
1201
      <xsl:choose>
1202
         <xsl:when test="$myName = 'div' and not(ancestor::tei:div)">
1203
            <xsl:call-template name="upLink">
1204
	              <xsl:with-param name="up" select="$BaseFile"/>
1205
	              <xsl:with-param name="title" select="$homeLabel"/>
1206
            </xsl:call-template>
1207
         </xsl:when>
1208
         <xsl:when test="$myName = 'div'">
1209
            <xsl:call-template name="upLink">
1210
               <xsl:with-param name="up" select="ancestor::tei:div[1]"/>
1211
            </xsl:call-template>
1212
         </xsl:when>
1213
         <xsl:when test="$myName='div1'">
1214
	           <xsl:call-template name="upLink">
1215
	              <xsl:with-param name="up" select="$BaseFile"/>
1216
	              <xsl:with-param name="title" select="$homeLabel"/>
1217
	           </xsl:call-template>
1218
         </xsl:when>
1219
         <xsl:when test="$myName='div2'">
1220
	           <xsl:call-template name="upLink">
1221
	              <xsl:with-param name="up" select="ancestor::tei:div1"/>
1222
	           </xsl:call-template>
1223
         </xsl:when>
1224
         <xsl:when test="$myName='div3'">
1225
	           <xsl:call-template name="upLink">
1226
	              <xsl:with-param name="up" select="ancestor::tei:div2"/>
1227
	           </xsl:call-template>
1228
         </xsl:when>
1229
         <xsl:when test="$myName='div4'">
1230
	           <xsl:call-template name="upLink">
1231
	              <xsl:with-param name="up" select="ancestor::tei:div3"/>
1232
	           </xsl:call-template>
1233
         </xsl:when>
1234
         <xsl:when test="$myName='div5'">
1235
	           <xsl:call-template name="upLink">
1236
	              <xsl:with-param name="up" select="ancestor::tei:div4"/>
1237
	           </xsl:call-template>
1238
         </xsl:when>
1239
         <xsl:otherwise>
1240
	           <xsl:call-template name="upLink">
1241
	              <xsl:with-param name="up" select="(ancestor::tei:div1|ancestor::tei:div)[1]"/>
1242
	           </xsl:call-template>
1243
         </xsl:otherwise>
1244
      </xsl:choose>
1245
  </xsl:template>
1246
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1247
      <desc>
1248
         <p>What happens at the end of an HTML file [html] </p>
1249
      </desc>
1250
   </doc>
1251
  <xsl:template name="htmlFileBottom">
1252
      <xsl:call-template name="topNavigation"/>
1253
      <xsl:call-template name="stdfooter"/>
1254
  </xsl:template>
1255
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1256
      <desc>[html] </desc>
1257
   </doc>
1258
  <xsl:template name="htmlFileTop">
1259
      <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. DO NOT EDIT (6)</xsl:comment>
1260
      <xsl:variable name="pagetitle">
1261
         <xsl:call-template name="generateTitle"/>
1262
      </xsl:variable>
1263
      <head>
1264
         <title>
1265
            <xsl:value-of select="$pagetitle"/>
1266
         </title>
1267
         <xsl:call-template name="headHook"/>
1268
         <xsl:call-template name="metaHTML">
1269
            <xsl:with-param name="title" select="$pagetitle"/>
1270
         </xsl:call-template>
1271
         <xsl:call-template name="includeCSS"/>
1272
         <xsl:call-template name="cssHook"/>
1273
         <xsl:call-template name="includeJavascript"/>
1274
         <xsl:call-template name="javascriptHook"/>
1275
      </head>
1276
  </xsl:template>
1277
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1278
      <desc>[html] </desc>
1279
   </doc>
1280
  <xsl:template name="includeCSS">
1281

    
1282
      <xsl:if test="string-length($cssFile)&gt;0">
1283
	<link href="{$cssFile}" rel="stylesheet" type="text/css"/>
1284
      </xsl:if>
1285

    
1286
      <xsl:if test="string-length($cssSecondaryFile)&gt;0">
1287
	<link href="{$cssSecondaryFile}" rel="stylesheet" type="text/css"/>
1288
      </xsl:if>
1289
      
1290
      <xsl:if test="string-length($cssPrintFile)&gt;0">
1291
	<link rel="stylesheet" media="print" type="text/css">
1292
	  <xsl:attribute name="href" select="$cssPrintFile"/>
1293
	</link>
1294
      </xsl:if>
1295
      
1296
      <xsl:if test="$cssInlineFile">
1297
	<style type="text/css" title="inline_css">
1298
	  <xsl:for-each select="tokenize(unparsed-text($cssInlineFile),
1299
				'\r?\n')">
1300
	    <xsl:value-of select="normalize-space(.)"/>
1301
	    <xsl:text>&#10;</xsl:text>
1302
	  </xsl:for-each>
1303
	</style>
1304
      </xsl:if>
1305

    
1306
      <xsl:call-template name="generateLocalCSS"/>
1307
      
1308
  </xsl:template>
1309

    
1310
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1311
      <desc>[html] Javascript functions to be declared in HTML header</desc>
1312
   </doc>
1313
   <xsl:template name="includeJavascript">
1314
  </xsl:template>
1315
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1316
      <desc>
1317
         <p>[html] Write out some Javascript into the HTML</p>
1318
         <p>Note that it does not have to commented if the output is
1319
    XHTML</p>
1320
         <param name="content">The code</param>
1321
      </desc>
1322
   </doc>
1323
  <xsl:template name="writeJavascript">
1324
      <xsl:param name="content"/>
1325
      <script type="text/javascript">
1326
	<xsl:value-of select="$content"/>
1327
      </script>
1328
  </xsl:template>
1329
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1330
      <desc>[html] Make contents of left-hand column<param name="currentID">currentID</param>
1331
      </desc>
1332
   </doc>
1333
  <xsl:template name="leftHandFrame">
1334
      <xsl:param name="currentID"/>
1335
      <xsl:call-template name="makeSidebar"/>
1336
      <xsl:choose>
1337
         <xsl:when test="$currentID=''">
1338
            <xsl:call-template name="linkListContents">
1339
               <xsl:with-param name="style" select="'toclist'"/>
1340
            </xsl:call-template>
1341
         </xsl:when>
1342
         <xsl:otherwise>
1343
            <xsl:choose>
1344
               <xsl:when test="count(id($currentID))&gt;0">
1345
                  <xsl:for-each select="id($currentID)">
1346
                     <xsl:call-template name="linkListContents">
1347
                        <xsl:with-param name="style" select="'toclist'"/>
1348
                     </xsl:call-template>
1349
                  </xsl:for-each>
1350
               </xsl:when>
1351
               <xsl:otherwise>
1352
                  <xsl:apply-templates mode="xpath" select="ancestor-or-self::tei:TEI/tei:text">
1353
                     <xsl:with-param name="xpath" select="$currentID"/>
1354
                     <xsl:with-param name="action" select="'toclist'"/>
1355
                  </xsl:apply-templates>
1356
               </xsl:otherwise>
1357
            </xsl:choose>
1358
         </xsl:otherwise>
1359
      </xsl:choose>
1360
  </xsl:template>
1361
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1362
      <desc>[html] bypass sidebar lists in normal mode</desc>
1363
   </doc>
1364
  <xsl:template match="tei:list[@type='sidebar']"/>
1365
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1366
      <desc>[html] Summary links in left-hand column</desc>
1367
   </doc>
1368
  <xsl:template name="makeSidebar">
1369
      <xsl:for-each select="ancestor-or-self::tei:TEI/tei:text/tei:body/tei:list[@type='sidebar']">
1370
         <xsl:for-each select=".//tei:ref">
1371
            <p class="sidebar">
1372
               <a class="toclist" href="{@url}">
1373
                  <xsl:apply-templates/>
1374
               </a>
1375
            </p>
1376
         </xsl:for-each>
1377
      </xsl:for-each>
1378
  </xsl:template>
1379
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1380
      <desc>[html] Summary table of contents in left-hand column<param name="style">style</param>
1381
      </desc>
1382
   </doc>
1383
  <xsl:template name="linkListContents">
1384
      <xsl:param name="style" select="'toc'"/>
1385
      <xsl:variable name="BaseFile">
1386
         <xsl:value-of select="$masterFile"/>
1387
         <xsl:call-template name="addCorpusID"/>
1388
      </xsl:variable>
1389
      <xsl:variable name="thisOne">
1390
         <xsl:value-of select="generate-id()"/>
1391
      </xsl:variable>
1392
      <xsl:for-each select="ancestor-or-self::tei:TEI/tei:text">
1393
      <!-- front matter -->
1394
      <xsl:for-each select="tei:front">
1395
	           <xsl:if test="tei:div1|tei:div">
1396
	              <div class="tocFront">
1397
	                 <xsl:element name="{$tocContainerElement}">
1398
	                    <xsl:attribute name="class">
1399
		                      <xsl:text>tocContainer</xsl:text>
1400
	                    </xsl:attribute>
1401
	                    <xsl:call-template name="tocSection">
1402
		                      <xsl:with-param name="id" select="$thisOne"/>
1403
		                      <xsl:with-param name="style" select="$style"/>
1404
	                    </xsl:call-template>
1405
	                 </xsl:element>
1406
	              </div>
1407
	           </xsl:if>
1408
         </xsl:for-each>
1409
         <!-- body matter -->
1410
      <xsl:for-each select="tei:body">
1411
	           <xsl:if test="tei:div1|tei:div">
1412
	              <div class="tocBody">
1413
	                 <xsl:comment>start TOC</xsl:comment>
1414
	                 <xsl:element name="{$tocContainerElement}">
1415
	                    <xsl:attribute name="class">
1416
		                      <xsl:text>tocContainer</xsl:text>
1417
	                    </xsl:attribute>
1418
	                    <xsl:comment>TOC components</xsl:comment>
1419
	                    <xsl:call-template name="tocSection">
1420
		                      <xsl:with-param name="id" select="$thisOne"/>
1421
		                      <xsl:with-param name="style" select="$style"/>
1422
	                    </xsl:call-template>
1423
	                 </xsl:element>
1424
	              </div>
1425
	           </xsl:if>
1426
         </xsl:for-each>
1427
         <!-- back matter -->
1428
      <xsl:for-each select="tei:back">
1429
	           <xsl:if test="tei:div1|tei:div">
1430
	              <div class="tocBack">
1431
	                 <xsl:element name="{$tocContainerElement}">
1432
	                    <xsl:attribute name="class">
1433
		                      <xsl:text>tocContainer</xsl:text>
1434
	                    </xsl:attribute>
1435
	                    <xsl:call-template name="tocSection">
1436
		                      <xsl:with-param name="id" select="$thisOne"/>
1437
		                      <xsl:with-param name="style" select="$style"/>
1438
	                    </xsl:call-template>
1439
	                 </xsl:element>
1440
	              </div>
1441
	           </xsl:if>
1442
         </xsl:for-each>
1443
      </xsl:for-each>
1444
  </xsl:template>
1445
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1446
      <desc>[html] Main page in right-hand column<param name="currentID">currentID</param>
1447
      </desc>
1448
   </doc>
1449
  <xsl:template name="mainFrame">
1450
      <xsl:param name="currentID"/>
1451
      <xsl:param name="minimal">false</xsl:param>
1452
      <xsl:choose>
1453
         <xsl:when test="$currentID='current'">
1454
            <xsl:apply-templates/>
1455
         </xsl:when>
1456
         <xsl:when test="$currentID='' and number($splitLevel)=-1">
1457
            <xsl:apply-templates/>
1458
         </xsl:when>
1459
         <xsl:when test="self::teiCorpus.2">
1460
            <xsl:call-template name="corpusBody"/>
1461
         </xsl:when>
1462
         <xsl:when test="$currentID=''">
1463
        <!-- we need to locate the first interesting object in the file, ie
1464
	     the first grandchild of <text > -->
1465
        <xsl:for-each select=" descendant-or-self::tei:TEI/tei:text/tei:*[1]/*[1]">
1466
               <xsl:apply-templates mode="paging" select="."/>
1467
               <xsl:if test="$autoToc='true'">
1468
                  <xsl:if test="following-sibling::tei:div/tei:head">
1469
                     <xsl:call-template name="contentsHeading"/>
1470
                     <ul class="toc">
1471
                        <xsl:apply-templates mode="maketoc" select="following-sibling::tei:div">
1472
                           <xsl:with-param name="forcedepth" select="'0'"/>
1473
                        </xsl:apply-templates>
1474
                     </ul>
1475
                  </xsl:if>
1476
               </xsl:if>
1477
            </xsl:for-each>
1478
         </xsl:when>
1479
         <xsl:otherwise>
1480
            <xsl:choose>
1481
               <xsl:when test="count(id($currentID))&gt;0">
1482
                  <xsl:for-each select="id($currentID)">
1483
                     <h2>
1484
                        <xsl:apply-templates mode="xref" select="."/>
1485
			<xsl:call-template name="sectionHeadHook"/>
1486
                     </h2>
1487
		     <xsl:if test="$topNavigationPanel='true'">
1488
		       <xsl:element name="{if ($outputTarget='html5') then 'nav' else 'div'}">
1489
			 <xsl:call-template name="xrefpanel">
1490
			   <xsl:with-param name="homepage" select="concat($masterFile,$standardSuffix)"/>
1491
			   <xsl:with-param name="mode" select="local-name(.)"/>
1492
			 </xsl:call-template>
1493
		       </xsl:element>
1494
		     </xsl:if>
1495
                     <xsl:call-template name="doDivBody"/>
1496
                     <xsl:if test="$bottomNavigationPanel='true'">
1497
		       <xsl:element name="{if ($outputTarget='html5') then 'nav' else 'div'}">
1498
			 <xsl:call-template name="xrefpanel">
1499
			   <xsl:with-param name="homepage" select="concat($masterFile,$standardSuffix)"/>
1500
			   <xsl:with-param name="mode" select="local-name(.)"/>
1501
                        </xsl:call-template>
1502
		       </xsl:element>
1503
                     </xsl:if>
1504
                  </xsl:for-each>
1505
               </xsl:when>
1506
               <xsl:otherwise>
1507
            <!-- the passed ID is a pseudo-XPath expression
1508
		 which starts below TEI/tei:text.
1509
		 The real XPath syntax is changed to avoid problems
1510
	    -->
1511
            <xsl:choose>
1512
                     <xsl:when test="ancestor-or-self::tei:TEI/tei:group/tei:text">
1513
                        <xsl:apply-templates mode="xpath" select="ancestor-or-self::tei:TEI/tei:group/tei:text">
1514
                           <xsl:with-param name="xpath" select="$currentID"/>
1515
                        </xsl:apply-templates>
1516
                     </xsl:when>
1517
                     <xsl:otherwise>
1518
                        <xsl:apply-templates mode="xpath" select="ancestor-or-self::tei:TEI/tei:text">
1519
                           <xsl:with-param name="xpath" select="$currentID"/>
1520
                        </xsl:apply-templates>
1521
                     </xsl:otherwise>
1522
                  </xsl:choose>
1523
               </xsl:otherwise>
1524
            </xsl:choose>
1525
         </xsl:otherwise>
1526
      </xsl:choose>
1527

    
1528
      <xsl:if test="$minimal='false'">
1529
	<xsl:call-template name="partialFootNotes">
1530
	  <xsl:with-param name="currentID" select="$currentID"/>
1531
	</xsl:call-template>
1532
	<xsl:call-template name="stdfooter"/>
1533
      </xsl:if>
1534
  </xsl:template>
1535

    
1536
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1537
      <desc>[html] Table of contents       </desc>
1538
   </doc>
1539
  <xsl:template name="mainTOC">
1540
      <xsl:choose>
1541
	<xsl:when test="self::tei:teiCorpus">
1542
	  <ul class="toc toc_corpus">
1543
	    <xsl:for-each select="tei:TEI">
1544
	      <li>
1545
		<a>
1546
                  <xsl:attribute name="href">
1547
		    <xsl:apply-templates mode="generateLink" select="."/>
1548
                  </xsl:attribute>
1549
                  <xsl:call-template name="header">
1550
		    <xsl:with-param name="minimal">false</xsl:with-param>
1551
		    <xsl:with-param name="display">plain</xsl:with-param>
1552
                  </xsl:call-template>
1553
		</a>
1554
	      </li>
1555
	    </xsl:for-each>
1556
	  </ul>
1557
	</xsl:when>
1558
	<xsl:when
1559
	    test="ancestor-or-self::tei:TEI/tei:text/tei:group and
1560
		  $splitLevel=0">
1561
	  <xsl:for-each
1562
	      select="ancestor-or-self::tei:TEI/tei:text/tei:front">
1563
	       <xsl:call-template name="partTOC">
1564
		 <xsl:with-param name="part">front</xsl:with-param>
1565
	       </xsl:call-template>
1566
	  </xsl:for-each>
1567
	  
1568
	  <xsl:for-each
1569
	      select="ancestor-or-self::tei:TEI/tei:text/tei:group">
1570
	    <xsl:call-template name="groupTOC"/>
1571
	  </xsl:for-each>
1572

    
1573
	  <xsl:for-each
1574
	      select="ancestor-or-self::tei:TEI/tei:text/tei:back">
1575
	    <xsl:call-template name="partTOC">
1576
	      <xsl:with-param name="part">back</xsl:with-param>
1577
	    </xsl:call-template>
1578
	  </xsl:for-each>
1579
	</xsl:when>
1580
	
1581
	<xsl:when
1582
	    test="ancestor-or-self::tei:TEI/tei:text/tei:group">	  
1583
	  <xsl:for-each
1584
	      select="ancestor-or-self::tei:TEI/tei:text/tei:group/tei:text">
1585
	    <h3>
1586
	      <xsl:number/>
1587
	      <xsl:choose>
1588
		<xsl:when test="tei:body/tei:head">
1589
		  <xsl:text>. </xsl:text>
1590
		  <xsl:apply-templates select="tei:body/tei:head" mode="plain"/>
1591
		</xsl:when>
1592
		<xsl:when
1593
		    test="tei:front/tei:titlePage//tei:title">
1594
		  <xsl:apply-templates select="tei:front/tei:titlePage//tei:title[1]" mode="plain"/>
1595
		</xsl:when>
1596
	      </xsl:choose>
1597
	    </h3>
1598
	    <xsl:for-each select="tei:front">
1599
	      <xsl:call-template name="partTOC">
1600
		<xsl:with-param name="part">front</xsl:with-param>
1601
	      </xsl:call-template>
1602
	    </xsl:for-each>
1603
	    
1604
	    <xsl:for-each select="tei:body">
1605
	      <xsl:call-template name="partTOC">
1606
		<xsl:with-param name="part">body</xsl:with-param>
1607
	      </xsl:call-template>
1608
	    </xsl:for-each>
1609
	    
1610
	    <xsl:for-each select="tei:back">
1611
	      <xsl:call-template name="partTOC">
1612
		<xsl:with-param name="part">back</xsl:with-param>
1613
	      </xsl:call-template>
1614
	    </xsl:for-each>
1615
	    
1616
	  </xsl:for-each>
1617
	  
1618
	</xsl:when>
1619
	<xsl:otherwise>
1620
	  <xsl:if test="$tocFront">
1621
	    <xsl:for-each select="ancestor-or-self::tei:TEI/tei:text/tei:front">
1622
	      <xsl:call-template name="partTOC">
1623
		<xsl:with-param name="part">front</xsl:with-param>
1624
	      </xsl:call-template>
1625
	    </xsl:for-each>
1626
	  </xsl:if>
1627
	  
1628
	  <xsl:for-each select="ancestor-or-self::tei:TEI/tei:text/tei:body">
1629
	    <xsl:call-template name="partTOC">
1630
	      <xsl:with-param name="part">body</xsl:with-param>
1631
	    </xsl:call-template>
1632
	  </xsl:for-each>
1633
	  
1634
	  <xsl:if test="$tocBack">
1635
	    <xsl:for-each select="ancestor-or-self::tei:TEI/tei:text/tei:back">
1636
	      <xsl:call-template name="partTOC">
1637
		<xsl:with-param name="part">back</xsl:with-param>
1638
	      </xsl:call-template>
1639
	    </xsl:for-each>
1640
	  </xsl:if>
1641
	</xsl:otherwise>
1642
      </xsl:choose>
1643
    </xsl:template>
1644

    
1645
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1646
      <desc>
1647
         <p>[html] </p>
1648
	 <p xmlns="http://www.w3.org/1999/xhtml"> make table of
1649
	 contents for nested texts/groups</p>
1650
      </desc>
1651
   </doc>
1652
    <xsl:template name="groupTOC">
1653
      <xsl:variable name="gDepth"
1654
		    select="count(ancestor::tei:group)"/>
1655
      <ul class="toc toc_group{$gDepth}">	    	   
1656
	<li>
1657
	  <xsl:if test="not($autoHead='true') and not(tei:head or tei:body/tei:head or @n)">
1658
	    <xsl:attribute
1659
		name="class">headless</xsl:attribute>
1660
	  </xsl:if>
1661
	  <ul>
1662
	    <xsl:for-each select="tei:text">
1663
	      <li>
1664
		
1665
		<xsl:call-template name="header">
1666
		  <xsl:with-param name="toc">
1667
		    <xsl:apply-templates mode="generateLink" select="."/>
1668
		  </xsl:with-param>
1669
		  <xsl:with-param name="minimal">false</xsl:with-param>
1670
		  <xsl:with-param name="display">plain</xsl:with-param>
1671
		</xsl:call-template>
1672
		
1673
		<xsl:for-each select="tei:front">
1674
		  <xsl:if
1675
		      test="tei:titlePage/tei:docTitle/tei:titlePart">
1676
		    <span>
1677
		      <xsl:apply-templates
1678
			  select="tei:titlePage/tei:docTitle/tei:titlePart"
1679
			  mode="plain"/>
1680
		    </span>
1681
		  </xsl:if>
1682
		  <xsl:call-template name="partTOC">
1683
		    <xsl:with-param name="part">front</xsl:with-param>
1684
		  </xsl:call-template>
1685
		</xsl:for-each>
1686
		
1687
		<xsl:for-each select="tei:group">
1688
		  <xsl:call-template name="groupTOC"/>
1689
		</xsl:for-each>
1690
		
1691
		<xsl:for-each select="tei:body">
1692
		  <xsl:call-template name="partTOC">
1693
		    <xsl:with-param name="part">body</xsl:with-param>
1694
		  </xsl:call-template>
1695
		</xsl:for-each>
1696
		
1697
		<xsl:for-each select="tei:back">
1698
		  <xsl:call-template name="partTOC">
1699
		    <xsl:with-param name="part">back</xsl:with-param>
1700
		  </xsl:call-template>
1701
		</xsl:for-each>
1702
	      </li>
1703
	    </xsl:for-each>
1704
	    <xsl:for-each select="tei:group">
1705
	      <li>
1706
		<xsl:call-template name="groupTOC"/>
1707
	      </li>
1708
	    </xsl:for-each>
1709
	</ul>
1710
      </li>
1711
      </ul>
1712
    </xsl:template>
1713

    
1714
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1715
      <desc>
1716
         <p>[html] </p>
1717
	 <p xmlns="http://www.w3.org/1999/xhtml"> make partial
1718
	    table of contents         </p>
1719
      </desc>
1720
   </doc>
1721
  <xsl:template name="partTOC">
1722
      <xsl:param name="part"/>
1723
      <xsl:param name="force"/>
1724
      <xsl:if test="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
1725
         <ul class="toc{$force} toc_{$part}">
1726
	   <xsl:apply-templates mode="maketoc"
1727
				select="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
1728
	              <xsl:with-param name="forcedepth" select="$force"/>
1729
	   </xsl:apply-templates>
1730
         </ul>
1731
      </xsl:if>
1732
  </xsl:template>
1733
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1734
      <desc>
1735
         <p>[html] </p>
1736
         <p>
1737
            <p xmlns="http://www.w3.org/1999/xhtml"> xref to previous and last sections </p>
1738
         </p>
1739
      </desc>
1740
   </doc>
1741
  <xsl:template name="nextLink">
1742
      <xsl:variable name="myName">
1743
         <xsl:value-of select="local-name(.)"/>
1744
      </xsl:variable>
1745
      <xsl:choose>
1746
         <xsl:when test="following-sibling::tei:TEI">
1747
            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:TEI[1]"/>
1748
         </xsl:when>
1749
         <xsl:when test="following-sibling::tei:div[tei:head or $autoHead='true']">
1750
            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div[1]"/>
1751
         </xsl:when>
1752
         <xsl:when test="parent::tei:body/following-sibling::tei:back/tei:div[tei:head or $autoHead='true']">
1753
            <xsl:apply-templates mode="generateNextLink"
1754
                                 select="parent::tei:body/following-sibling::tei:back/tei:div[1]"/>
1755
         </xsl:when>
1756
         <xsl:when test="parent::tei:front/following-sibling::tei:body/tei:div[tei:head or $autoHead='true']">
1757
            <xsl:apply-templates mode="generateNextLink"
1758
                                 select="parent::tei:front/following-sibling::tei:body/tei:div[1]"/>
1759
         </xsl:when>
1760
         <xsl:when test="$myName='div1' and following-sibling::tei:div1[tei:head or $autoHead='true']">
1761
            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div1[1]"/>
1762
         </xsl:when>
1763
         <xsl:when test="$myName='div2' and following-sibling::tei:div2[tei:head or $autoHead='true']">
1764
            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div2[1]"/>
1765
         </xsl:when>
1766
         <xsl:when test="$myName='div3' and following-sibling::tei:div3[tei:head or $autoHead='true']">
1767
            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div3[1]"/>
1768
         </xsl:when>
1769
         <xsl:when test="$myName='div4' and following-sibling::tei:div4[tei:head or $autoHead='true']">
1770
            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div4[1]"/>
1771
         </xsl:when>
1772
         <xsl:when test="$myName='div5' and following-sibling::tei:div5[tei:head or $autoHead='true']">
1773
            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div5[1]"/>
1774
         </xsl:when>
1775
         <xsl:when test="$myName='div6' and following-sibling::tei:div6[tei:head or $autoHead='true']">
1776
            <xsl:apply-templates mode="generateNextLink" select="following-sibling::tei:div6[1]"/>
1777
         </xsl:when>
1778
      </xsl:choose>
1779
  </xsl:template>
1780
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1781
      <desc>[html] Generate name for a chunk of output<param name="ident">ident</param>
1782
      </desc>
1783
   </doc>
1784
  <xsl:template name="outputChunkName">
1785
      <xsl:param name="ident"/>
1786
      <xsl:choose>
1787
        <xsl:when test="not($outputDir ='')">
1788
            <xsl:value-of select="$outputDir"/>
1789
            <xsl:if test="not(substring($outputDir,string-length($outputDir),string-length($outputDir))='/')">
1790
               <xsl:text>/</xsl:text>
1791
            </xsl:if>
1792
        </xsl:when>
1793
      </xsl:choose>
1794
      <xsl:value-of select="$ident"/>
1795
      <xsl:value-of select="$outputSuffix"/>
1796
  </xsl:template>
1797
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1798
      <desc>[html] Make a new page using CSS layout <param name="currentID">current ID</param>
1799
      </desc>
1800
   </doc>
1801
  <xsl:template name="pageLayoutCSS">
1802
      <xsl:param name="currentID"/>
1803
      <html>
1804
         <xsl:call-template name="addLangAtt"/>
1805
         <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. DO NOT EDIT (4)</xsl:comment>
1806
         <xsl:text>&#10;</xsl:text>
1807
         <head>
1808
	   <xsl:variable name="pagetitle">
1809
	     <xsl:choose>
1810
	       <xsl:when test="$currentID=''">
1811
		 <xsl:call-template name="generateTitle"/>
1812
	       </xsl:when>
1813
	       <xsl:otherwise>
1814
		 <xsl:choose>
1815
		   <xsl:when test="$currentID='current'">
1816
		     <xsl:apply-templates mode="xref" select="."/>
1817
		   </xsl:when>
1818
		   <xsl:when test="count(id($currentID))&gt;0">
1819
		     <xsl:for-each select="id($currentID)">
1820
		       <xsl:apply-templates mode="xref" select="."/>
1821
		     </xsl:for-each>
1822
		   </xsl:when>
1823
		   <xsl:otherwise>
1824
		     <xsl:apply-templates mode="xpath" select="descendant::text">
1825
		       <xsl:with-param name="xpath" select="$currentID"/>
1826
		       <xsl:with-param name="action" select="'header'"/>
1827
		     </xsl:apply-templates>
1828
		   </xsl:otherwise>
1829
		 </xsl:choose>
1830
		 <xsl:text> - </xsl:text>
1831
		 <xsl:call-template name="generateTitle"/>
1832
	       </xsl:otherwise>
1833
	     </xsl:choose>
1834
	   </xsl:variable>
1835
	   <title>
1836
	     <xsl:value-of select="$htmlTitlePrefix"/>
1837
	     <xsl:text> </xsl:text>
1838
	     <xsl:value-of select="$pagetitle"/>
1839
	   </title>
1840
	   <link href="/favicon.ico" rel="icon" type="image/x-icon"/>
1841
	   <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
1842
	   <xsl:call-template name="headHook"/>
1843
	   <xsl:call-template name="metaHTML">
1844
	     <xsl:with-param name="title" select="$pagetitle"/>
1845
	   </xsl:call-template>
1846
	   <xsl:call-template name="includeCSS"/>
1847
	   <xsl:call-template name="cssHook"/>
1848
	   <xsl:call-template name="includeJavascript"/>
1849
	   <xsl:call-template name="javascriptHook"/>
1850
         </head>
1851
         <body>
1852
	   <xsl:copy-of select="tei:text/tei:body/@unload"/>
1853
	   <xsl:copy-of select="tei:text/tei:body/@onunload"/>
1854
	   <xsl:call-template name="bodyMicroData"/>
1855
	   <xsl:call-template name="bodyJavascriptHook"/>
1856
	   <xsl:call-template name="bodyHook"/>
1857
	   <xsl:call-template name="mainPage">
1858
	     <xsl:with-param name="currentID">
1859
	       <xsl:value-of select="$currentID"/>
1860
	     </xsl:with-param>
1861
	   </xsl:call-template>
1862
	   <xsl:call-template name="bodyEndHook"/>
1863
         </body>
1864
      </html>
1865
  </xsl:template>
1866
  
1867
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1868
      <desc>[html] the main page structure</desc>
1869
   </doc>
1870
  <xsl:template name="mainPage">
1871
      <xsl:param name="currentID"/>
1872
      <!-- header -->
1873
    <div id="hdr">
1874
         <xsl:call-template name="hdr"/>
1875
      </div>
1876
      <div id="accessibility">
1877
         <span class="tocontent">
1878
            <a href="{$REQUEST}?style=text">Text only</a>
1879
      | <a class="skiplinks" href="#rh-col" title="Go to main page content">Skip links</a>
1880
         </span>
1881
      </div>
1882
      <div id="hdr2">
1883
         <xsl:call-template name="hdr2"/>
1884
      </div>
1885
      <xsl:if test="not($contentStructure='all' or @rend='all')">
1886
         <div id="hdr3">
1887
	           <xsl:call-template name="hdr3"/>
1888
         </div>
1889
      </xsl:if>
1890
      <xsl:choose>
1891
         <xsl:when test="$contentStructure='all' or @rend='all'">
1892
	           <div class="column-wrapper">
1893
	              <xsl:call-template name="col1"/>
1894
	              <xsl:call-template name="col2"/>
1895
	              <xsl:call-template name="col3"/>
1896
	           </div>
1897
         </xsl:when>
1898
         <xsl:when test="@rend='frontpage'">
1899
	           <div class="column-wrapper">
1900
	              <div id="rh-col">
1901
	                 <xsl:for-each select="descendant-or-self::tei:TEI/tei:text/tei:body">
1902
	                    <xsl:apply-templates/>
1903
	                 </xsl:for-each>
1904
	              </div>
1905
	              <div id="lh-col">
1906
	                 <xsl:for-each select="descendant-or-self::tei:TEI/tei:text/tei:front">
1907
	                    <xsl:apply-templates/>
1908
	                 </xsl:for-each>
1909
	              </div>
1910
	           </div>
1911
         </xsl:when>
1912
         <xsl:when test="$contentStructure='body'">
1913
	           <xsl:call-template name="bodyLayout">
1914
	              <xsl:with-param name="currentID" select="$currentID"/>
1915
	           </xsl:call-template>
1916
         </xsl:when>
1917
      </xsl:choose>
1918
  </xsl:template>
1919

    
1920
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1921
      <desc>[html] what to do in column 1 of 3 column arrangement </desc>
1922
   </doc>
1923
  <xsl:template name="col1">
1924
      <div id="col1">
1925
         <xsl:for-each select="descendant-or-self::tei:TEI/tei:text/tei:front">
1926
            <xsl:apply-templates/>
1927
         </xsl:for-each>
1928
      </div>
1929
  </xsl:template>
1930
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1931
      <desc>[html] what to do in column 2 of 3 column arrangement </desc>
1932
   </doc>
1933
  <xsl:template name="col2">
1934
      <div id="col2">
1935
         <xsl:for-each select="descendant-or-self::tei:TEI/tei:text/tei:body">
1936
            <xsl:apply-templates/>
1937
         </xsl:for-each>
1938
      </div>
1939
  </xsl:template>
1940
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1941
      <desc>[html] what to do in column 3 of 3 column arrangement </desc>
1942
   </doc>
1943
  <xsl:template name="col3">
1944
      <div id="col3">
1945
         <xsl:for-each select="descendant-or-self::tei:TEI/tei:text/tei:back">
1946
            <xsl:apply-templates/>
1947
         </xsl:for-each>
1948
      </div>
1949
  </xsl:template>
1950
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1951
      <desc>[html] arrangment of page as HTML divs <param name="currentID">currentID</param>
1952
      </desc>
1953
   </doc>
1954
  <xsl:template name="bodyLayout">
1955
      <xsl:param name="currentID"/>
1956
      <div class="column-wrapper">
1957
         <div id="lh-col">
1958
            <div id="lh-col-top">
1959
               <xsl:comment>top of left-hand column</xsl:comment>
1960
               <xsl:call-template name="lh-col-top"/>
1961
            </div>
1962
            <div id="lh-col-bottom">
1963
               <xsl:comment>bottom of left-hand column</xsl:comment>
1964
               <xsl:call-template name="lh-col-bottom">
1965
                  <xsl:with-param name="currentID" select="$currentID"/>
1966
               </xsl:call-template>
1967
            </div>
1968
         </div>
1969
         <div id="rh-col">
1970
	   <div id="rh-col-top">
1971
	     <xsl:comment>top of right-hand column</xsl:comment>
1972
	     <xsl:call-template name="rh-col-top"/>
1973
            </div>
1974
            <div id="rh-col-bottom">
1975
               <xsl:comment>bottom of right-hand column</xsl:comment>
1976
               <xsl:call-template name="rh-col-bottom">
1977
                  <xsl:with-param name="currentID" select="$currentID"/>
1978
               </xsl:call-template>
1979
            </div>
1980
         </div>
1981
      </div>
1982
  </xsl:template>
1983
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
1984
      <desc>[html] Generate a page using simple layout </desc>
1985
   </doc>
1986
  <xsl:template name="pageLayoutSimple">
1987
      <html>
1988
         <xsl:call-template name="addLangAtt"/>
1989
         <xsl:call-template name="htmlFileTop"/>
1990
         <body class="simple" id="TOP">
1991
	   <xsl:copy-of select="tei:text/tei:body/@unload"/>
1992
	   <xsl:copy-of select="tei:text/tei:body/@onunload"/>
1993
	   <xsl:call-template name="bodyMicroData"/>
1994
	   <xsl:call-template name="bodyJavascriptHook"/>
1995
	   <xsl:call-template name="bodyHook"/>
1996
	   <xsl:if test="not(tei:text/tei:front/tei:titlePage)">
1997
	     <div class="stdheader">
1998
	       <xsl:call-template name="stdheader">
1999
		 <xsl:with-param name="title">
2000
		   <xsl:call-template name="generateTitle"/>
2001
		 </xsl:with-param>
2002
	       </xsl:call-template>
2003
	     </div>
2004
	   </xsl:if>
2005
	    <xsl:comment> front matter </xsl:comment>
2006
	    <xsl:apply-templates select="tei:text/tei:front"/>
2007
	    <xsl:if test="$autoToc='true' and (descendant::tei:div or descendant::tei:div1) and not(descendant::tei:divGen[@type='toc'])">
2008
	      <h2>
2009
		<xsl:call-template name="i18n">
2010
		  <xsl:with-param name="word">tocWords</xsl:with-param>
2011
		</xsl:call-template>
2012
	      </h2>
2013
	      <xsl:call-template name="mainTOC"/>
2014
	    </xsl:if>
2015
	    <xsl:choose>
2016
	      <xsl:when test="tei:text/tei:group">
2017
		<xsl:apply-templates select="tei:text/tei:group"/>
2018
	      </xsl:when>
2019
	      <xsl:when test="@rend='multicol'">
2020
		<table>
2021
		  <tr>
2022
		    <xsl:apply-templates select="tei:text/tei:body"/>
2023
		  </tr>
2024
		</table>
2025
	      </xsl:when>
2026
	      <xsl:otherwise>
2027
		<xsl:comment>body matter </xsl:comment>
2028
		<xsl:call-template name="startHook"/>
2029
		<xsl:variable name="ident">
2030
		  <xsl:apply-templates mode="ident" select="."/>
2031
		</xsl:variable>
2032
		<xsl:apply-templates select="tei:text/tei:body"/>
2033
	      </xsl:otherwise>
2034
	    </xsl:choose>
2035
	    <xsl:comment>back matter </xsl:comment>
2036
	    <xsl:apply-templates select="tei:text/tei:back"/>
2037
            <xsl:call-template name="printNotes"/>
2038
            <xsl:call-template name="htmlFileBottom"/>
2039
            <xsl:call-template name="bodyEndHook"/>
2040
         </body>
2041
      </html>
2042
  </xsl:template>
2043
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2044
      <desc>[html] Generate a page using table layout<param name="currentID">currentID</param>
2045
      </desc>
2046
   </doc>
2047
  <xsl:template name="pageLayoutTable">
2048
      <xsl:param name="currentID"/>
2049
      <html>
2050
         <xsl:call-template name="addLangAtt"/>
2051
         <xsl:comment>THIS FILE IS GENERATED FROM AN XML MASTER. DO NOT EDIT (1)</xsl:comment>
2052
         <xsl:text>&#10;</xsl:text>
2053
         <head>
2054
            <xsl:variable name="pagetitle">
2055
               <xsl:choose>
2056
                  <xsl:when test="$currentID=''">
2057
                     <xsl:call-template name="generateTitle"/>
2058
                  </xsl:when>
2059
                  <xsl:otherwise>
2060
                     <xsl:call-template name="generateTitle"/>: <xsl:choose>
2061
                        <xsl:when test="count(id($currentID))&gt;0">
2062
                           <xsl:for-each select="id($currentID)">
2063
                              <xsl:apply-templates mode="xref" select="."/>
2064
                           </xsl:for-each>
2065
                        </xsl:when>
2066
                        <xsl:otherwise>
2067
                           <xsl:apply-templates mode="xpath" select="descendant-or-self::tei:TEI/tei:text">
2068
                              <xsl:with-param name="xpath" select="$currentID"/>
2069
                              <xsl:with-param name="action" select="'header'"/>
2070
                           </xsl:apply-templates>
2071
                        </xsl:otherwise>
2072
                     </xsl:choose>
2073
                  </xsl:otherwise>
2074
               </xsl:choose>
2075
            </xsl:variable>
2076
            <title>
2077
               <xsl:value-of select="$htmlTitlePrefix"/>
2078
               <xsl:value-of select="$pagetitle"/>
2079
            </title>
2080
            <link href="/favicon.ico" rel="icon" type="image/x-icon"/>
2081
            <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
2082
            <xsl:call-template name="headHook"/>
2083
            <xsl:call-template name="metaHTML">
2084
               <xsl:with-param name="title" select="$pagetitle"/>
2085
            </xsl:call-template>
2086
            <xsl:call-template name="includeCSS"/>
2087
            <xsl:call-template name="cssHook"/>
2088
            <xsl:call-template name="includeJavascript"/>
2089
            <xsl:call-template name="javascriptHook"/>
2090
         </head>
2091
         <body class="pagetable">
2092
            <xsl:call-template name="bodyMicroData"/>
2093
            <xsl:call-template name="bodyJavascriptHook"/>
2094
	    <xsl:call-template name="bodyHook"/>
2095
            <xsl:call-template name="pageHeader">
2096
               <xsl:with-param name="mode">table</xsl:with-param>
2097
            </xsl:call-template>
2098
            <xsl:call-template name="pageLayoutTableBody">
2099
               <xsl:with-param name="currentID" select="$currentID"/>
2100
            </xsl:call-template>
2101
            <xsl:call-template name="bodyEndHook"/>
2102
         </body>
2103
      </html>
2104
  </xsl:template>
2105
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2106
      <desc>[html] The page body, when using table layout<param name="currentID">currentID</param>
2107
      </desc>
2108
   </doc>
2109
  <xsl:template name="pageLayoutTableBody">
2110
      <xsl:param name="currentID"/>
2111
      <table>
2112
         <tr>
2113
            <td class="hdr" colspan="2">
2114
               <xsl:call-template name="hdr"/>
2115
            </td>
2116
         </tr>
2117
         <tr>
2118
            <td class="hdr2" colspan="2">
2119
               <xsl:call-template name="hdr2"/>
2120
            </td>
2121
         </tr>
2122
         <tr>
2123
            <td class="hdr3" colspan="2">
2124
               <xsl:call-template name="hdr3"/>
2125
            </td>
2126
         </tr>
2127
         <tr>
2128
            <td align="left" class="sidetext" rowspan="2" style="vertical-align:top;" width="{$linksWidth}">
2129
               <xsl:call-template name="searchbox"/>
2130
               <xsl:call-template name="leftHandFrame">
2131
                  <xsl:with-param name="currentID" select="$requestedID"/>
2132
               </xsl:call-template>
2133
            </td>
2134
         </tr>
2135
         <tr>
2136
            <td class="maintext" colspan="2" style="vertical-align:top;">
2137
               <xsl:call-template name="mainFrame">
2138
                  <xsl:with-param name="currentID" select="$currentID"/>
2139
               </xsl:call-template>
2140
            </td>
2141
         </tr>
2142
      </table>
2143
  </xsl:template>
2144
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2145
      <desc>[html] </desc>
2146
   </doc>
2147
  <xsl:template name="previousLink">
2148
      <xsl:variable name="myName">
2149
         <xsl:value-of select="local-name(.)"/>
2150
      </xsl:variable>
2151
      <xsl:choose>
2152
         <xsl:when test="preceding-sibling::tei:TEI">
2153
            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:TEI[1]"/>
2154
         </xsl:when>
2155
         <xsl:when test="preceding-sibling::tei:div[tei:head or $autoHead='true']">
2156
            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div[1]"/>
2157
         </xsl:when>
2158
         <xsl:when test="parent::tei:body/preceding-sibling::tei:front/tei:div[tei:head or $autoHead='true']">
2159
            <xsl:apply-templates mode="generatePreviousLink"
2160
                                 select="parent::tei:body/preceding-sibling::tei:front/tei:div[last()]"/>
2161
         </xsl:when>
2162
         <xsl:when test="parent::tei:back/preceding-sibling::tei:body/tei:div[tei:head or $autoHead='true']">
2163
            <xsl:apply-templates mode="generatePreviousLink"
2164
                                 select="parent::tei:body/preceding-sibling::tei:body/tei:div[last()]"/>
2165
         </xsl:when>
2166
         <xsl:when test="$myName='div1' and preceding-sibling::tei:div1[tei:head or $autoHead='true']">
2167
            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div1[1]"/>
2168
         </xsl:when>
2169
         <xsl:when test="$myName='div2' and preceding-sibling::tei:div2[tei:head or $autoHead='true']">
2170
            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div2[1]"/>
2171
         </xsl:when>
2172
         <xsl:when test="$myName='div3' and preceding-sibling::tei:div3[tei:head or $autoHead='true']">
2173
            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div3[1]"/>
2174
         </xsl:when>
2175
         <xsl:when test="$myName='div4' and preceding-sibling::tei:div4[tei:head or $autoHead='true']">
2176
            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div4[1]"/>
2177
         </xsl:when>
2178
         <xsl:when test="$myName='div5' and preceding-sibling::tei:div5[tei:head or $autoHead='true']">
2179
            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div5[1]"/>
2180
         </xsl:when>
2181
         <xsl:when test="$myName='div6' and preceding-sibling::tei:div6[tei:head or $autoHead='true']">
2182
            <xsl:apply-templates mode="generatePreviousLink" select="preceding-sibling::tei:div6[1]"/>
2183
         </xsl:when>
2184
      </xsl:choose>
2185
  </xsl:template>
2186
  <xsl:template name="simpleBody">
2187
    <xsl:choose>
2188
      <xsl:when test="tei:text/tei:group">
2189
	<xsl:apply-templates select="tei:text/tei:group"/>
2190
      </xsl:when>
2191
       <xsl:when test="$filePerPage='true'">
2192
	 <xsl:variable name="pass1">	 
2193
	   <xsl:apply-templates select="tei:text/*"/>
2194
	 </xsl:variable>
2195
	 <xsl:choose>
2196
	   <xsl:when test="not($pass1/html:PAGEBREAK)">
2197
	     <xsl:for-each-group select="$pass1/*"
2198
				 group-ending-with="*[(position() mod 40) = 0]">
2199
	       <xsl:call-template name="pageperfile">
2200
		 <xsl:with-param name="page">
2201
		   <xsl:text>page</xsl:text>
2202
		   <xsl:value-of select="position()"/>
2203
		 </xsl:with-param>
2204
	       </xsl:call-template>
2205
	     </xsl:for-each-group>
2206
	   </xsl:when>
2207
	   <xsl:otherwise>
2208
	     <xsl:for-each-group select="$pass1/*"
2209
				 group-starting-with="html:PAGEBREAK">
2210
	       <xsl:choose>
2211
		 <xsl:when test="self::html:PAGEBREAK">
2212
		   <xsl:call-template name="pageperfile">
2213
		     <xsl:with-param name="page" select="self::html:PAGEBREAK/@name"/>
2214
		   </xsl:call-template>
2215
		 </xsl:when>
2216
		 <xsl:otherwise>
2217
		   <xsl:copy-of select="current-group()"/>
2218
		 </xsl:otherwise>
2219
	       </xsl:choose>
2220
	     </xsl:for-each-group>
2221
	   </xsl:otherwise>
2222
	 </xsl:choose>
2223
       </xsl:when>
2224
      <xsl:otherwise>
2225
    <!-- front matter -->
2226
    <xsl:apply-templates select="tei:text/tei:front"/>
2227
      <xsl:if test="$autoToc='true' and (descendant::tei:div or descendant::tei:div1) and not(descendant::tei:divGen[@type='toc'])">
2228
         <h2>
2229
            <xsl:call-template name="i18n">
2230
               <xsl:with-param name="word">tocWords</xsl:with-param>
2231
            </xsl:call-template>
2232
         </h2>
2233
         <xsl:call-template name="mainTOC"/>
2234
      </xsl:if>
2235
      <!-- main text -->
2236
	<xsl:apply-templates select="tei:text/tei:body"/>
2237
      </xsl:otherwise>
2238
    </xsl:choose>
2239
    <!-- back matter -->
2240
    <xsl:apply-templates select="tei:text/tei:back"/>
2241
      <xsl:call-template name="printNotes"/>
2242
  </xsl:template>
2243

    
2244
  <xsl:template name="pageperfile">
2245
    <xsl:param name="page"/>
2246
    <xsl:variable name="outName">
2247
      <xsl:call-template name="outputChunkName">
2248
	<xsl:with-param name="ident">
2249
	  <xsl:value-of select="$page"/>
2250
	</xsl:with-param>
2251
      </xsl:call-template>
2252
    </xsl:variable>
2253
    <xsl:if test="$verbose='true'">
2254
      <xsl:message>Opening file <xsl:value-of select="$outName"/></xsl:message>
2255
    </xsl:if>
2256
    
2257
    <xsl:result-document href="{$outName}">
2258
      <html>
2259
	<xsl:call-template name="addLangAtt"/>
2260
	<head>
2261
	  <xsl:variable name="pagetitle">
2262
	    <xsl:call-template name="generateTitle"/>
2263
	    <xsl:text> page </xsl:text>
2264
	    <xsl:value-of select="$page"/>
2265
	  </xsl:variable>
2266
	  <title>
2267
	    <xsl:value-of select="$pagetitle"/>
2268
	  </title>
2269
	  <xsl:call-template name="headHook"/>
2270
	  <xsl:call-template name="metaHTML">
2271
	    <xsl:with-param name="title" select="$pagetitle"/>
2272
	  </xsl:call-template>
2273
	  <xsl:call-template name="includeCSS"/>
2274
	  <xsl:call-template name="cssHook"/>
2275
	  <xsl:call-template name="includeJavascript"/>
2276
	  <xsl:call-template name="javascriptHook"/>
2277
	</head>
2278
	<body>
2279
	  <xsl:apply-templates select="current-group()" mode="copy"/>
2280
	</body>
2281
      </html>
2282
    </xsl:result-document>
2283
    <xsl:if test="@facs">
2284
      <xsl:variable name="outNameFacs">
2285
	<xsl:call-template name="outputChunkName">
2286
	  <xsl:with-param name="ident">
2287
	    <xsl:value-of select="$page"/>
2288
	    <xsl:text>-facs</xsl:text>
2289
	  </xsl:with-param>
2290
	</xsl:call-template>
2291
      </xsl:variable>
2292
      <xsl:result-document href="{$outNameFacs}">
2293
	<html>
2294
	  <xsl:call-template name="addLangAtt"/>
2295
	  <head>
2296
	    <xsl:variable name="pagetitle">
2297
	      <xsl:call-template name="generateTitle"/>
2298
	      <xsl:text> page </xsl:text>
2299
	      <xsl:value-of select="$page"/>
2300
	      <xsl:text> (facsimile) </xsl:text>
2301
	    </xsl:variable>
2302
	    <title>
2303
	      <xsl:value-of select="$pagetitle"/>
2304
	    </title>
2305
	    <xsl:call-template name="headHook"/>
2306
	    <xsl:call-template name="metaHTML">
2307
	      <xsl:with-param name="title" select="$pagetitle"/>
2308
	    </xsl:call-template>
2309
	    <xsl:call-template name="includeCSS"/>
2310
	    <xsl:call-template name="cssHook"/>
2311
	    <xsl:call-template name="includeJavascript"/>
2312
	    <xsl:call-template name="javascriptHook"/>
2313
	  </head>
2314
	  <body style="margin:0;padding:0">
2315
	    <p><img src="{@facs}" class="fullpage" alt="page facsimile"/></p>
2316
	  </body>
2317
	</html>
2318
      </xsl:result-document>      
2319
    </xsl:if>
2320
  </xsl:template>
2321

    
2322
  <xsl:template match="html:PAGEBREAK" mode="copy"/>
2323
  <xsl:template match="html:*" mode="copy">
2324
    <xsl:copy-of select="."/>
2325
  </xsl:template>
2326

    
2327
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2328
      <desc>[html] </desc>
2329
   </doc>
2330
  <xsl:template name="stdfooter">
2331
      <xsl:param name="style" select="'plain'"/>
2332
      <xsl:param name="file"/>
2333
      <xsl:variable name="date">
2334
         <xsl:call-template name="generateDate"/>
2335
      </xsl:variable>
2336
      <xsl:variable name="author">
2337
         <xsl:call-template name="generateAuthor"/>
2338
      </xsl:variable>
2339
      <div class="stdfooter">
2340
         <xsl:if test="$linkPanel='true'">
2341
            <div class="footer">
2342
               <xsl:if test="not($parentURL='')">
2343
                  <a class="{$style}" href="{$parentURL}">
2344
                     <xsl:value-of select="$parentWords"/>
2345
                  </a> | </xsl:if>
2346
               <a class="{$style}" href="{$homeURL}">
2347
                  <xsl:value-of select="$homeWords"/>
2348
               </a>
2349
               <xsl:if test="$searchURL">
2350
		 <xsl:text>| </xsl:text>
2351
		 <a class="{$style}" href="{$searchURL}">
2352
		   <xsl:call-template name="i18n">
2353
		     <xsl:with-param name="word">searchWords</xsl:with-param>
2354
		   </xsl:call-template>            
2355
		 </a>
2356
               </xsl:if>
2357
               <xsl:if test="$feedbackURL"> | <a class="{$style}" href="{$feedbackURL}">
2358
	       <xsl:call-template name="i18n">
2359
		 <xsl:with-param name="word">feedbackWords</xsl:with-param>
2360
	       </xsl:call-template>
2361
	     </a>
2362
               </xsl:if>
2363
            </div>
2364
         </xsl:if>
2365
         <xsl:call-template name="preAddressHook"/>
2366
         <address>
2367
            <xsl:if test="not($author='')">
2368
               <xsl:text> </xsl:text>
2369
               <xsl:value-of select="$author"/>.
2370
      </xsl:if>
2371
            <xsl:call-template name="i18n">
2372
               <xsl:with-param name="word">dateWord</xsl:with-param>
2373
            </xsl:call-template>
2374
            <xsl:text>: </xsl:text>
2375
            <xsl:value-of select="$date"/>
2376
            <br/>
2377
            <xsl:call-template name="copyrightStatement"/>
2378
            <xsl:comment>
2379
               <xsl:text>
2380
	  Generated </xsl:text>
2381
               <xsl:if test="not($masterFile='index')">
2382
                  <xsl:text>from </xsl:text>
2383
                  <xsl:value-of select="$masterFile"/>
2384
               </xsl:if>
2385
               <xsl:text> using an XSLT version </xsl:text>
2386
               <xsl:value-of select="system-property('xsl:version')"/> stylesheet
2387
	  based on <xsl:value-of select="$teixslHome"/>
2388
	  processed using <xsl:value-of select="system-property('xsl:vendor')"/>
2389
	  on <xsl:call-template name="whatsTheDate"/>
2390
            </xsl:comment>
2391
         </address>
2392
      </div>
2393
  </xsl:template>
2394
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2395
      <desc>[html] <param name="title">title</param>
2396
      </desc>
2397
   </doc>
2398
  <xsl:template name="stdheader">
2399
      <xsl:param name="title">(no title)</xsl:param>
2400
      <xsl:choose>
2401
         <xsl:when test="$pageLayout='Simple'">
2402
	   <xsl:if test="not($institution='')">
2403
            <h2 class="institution">
2404
               <xsl:value-of select="$institution"/>
2405
            </h2>
2406
	   </xsl:if>
2407
	   <xsl:if test="not($department='')">
2408
            <h2 class="department">
2409
               <xsl:value-of select="$department"/>
2410
            </h2>
2411
	   </xsl:if>
2412
	   
2413
	   <xsl:call-template name="makeHTMLHeading">
2414
	     <xsl:with-param name="class">maintitle</xsl:with-param>
2415
	     <xsl:with-param name="text">
2416
	       <xsl:copy-of select="$title"/>
2417
	     </xsl:with-param>
2418
	     <xsl:with-param name="level">1</xsl:with-param>
2419
	   </xsl:call-template>
2420
	   
2421
	   <xsl:call-template name="makeHTMLHeading">
2422
	     <xsl:with-param name="class">subtitle</xsl:with-param>
2423
	     <xsl:with-param name="text">
2424
	       <xsl:call-template name="generateSubTitle"/>
2425
	     </xsl:with-param>
2426
	     <xsl:with-param name="level">2</xsl:with-param>
2427
	   </xsl:call-template>
2428
	   
2429

    
2430
	   <xsl:if test="$showTitleAuthor='true'">
2431
	     <xsl:if test="$verbose='true'">
2432
	       <xsl:message>displaying author and date</xsl:message>
2433
	     </xsl:if>
2434
	     <xsl:call-template name="generateAuthorList"/>
2435
	     <xsl:call-template name="generateDate"/>
2436
	     <xsl:call-template name="generateEdition"/>
2437
	   </xsl:if>
2438
	 </xsl:when>
2439
	 <xsl:otherwise>
2440
	   <xsl:call-template name="makeHTMLHeading">
2441
	     <xsl:with-param name="class">maintitle</xsl:with-param>
2442
	     <xsl:with-param name="text">
2443
	       <xsl:value-of select="$title"/>
2444
	     </xsl:with-param>
2445
	     <xsl:with-param name="level">1</xsl:with-param>
2446
	   </xsl:call-template>
2447
	   
2448
	   <xsl:call-template name="makeHTMLHeading">
2449
	     <xsl:with-param name="class">subtitle</xsl:with-param>
2450
	     <xsl:with-param name="text">
2451
	       <xsl:call-template name="generateTitle"/>
2452
	     </xsl:with-param>
2453
	     <xsl:with-param name="level">2</xsl:with-param>
2454
	   </xsl:call-template>
2455
	   
2456
	   <xsl:if test="$showTitleAuthor='true'">
2457
	     <xsl:if test="$verbose='true'">
2458
	       <xsl:message>displaying author and date</xsl:message>
2459
	     </xsl:if>
2460
	     <xsl:call-template name="generateAuthorList"/>
2461
	     <xsl:call-template name="generateDate"/>
2462
	     <xsl:call-template name="generateEdition"/>
2463
	   </xsl:if>
2464
	 </xsl:otherwise>
2465
      </xsl:choose>
2466
  </xsl:template>
2467

    
2468
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2469
      <desc>[html] </desc>
2470
   </doc>
2471
  <xsl:template name="subtoc">
2472
      <xsl:if test="child::tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
2473
         <xsl:variable name="parent">
2474
            <xsl:choose>
2475
               <xsl:when test="ancestor::tei:div">
2476
                  <xsl:apply-templates mode="ident" select="ancestor::tei:div[last()]"/>
2477
               </xsl:when>
2478
               <xsl:otherwise>
2479
                  <xsl:apply-templates mode="ident" select="."/>
2480
               </xsl:otherwise>
2481
            </xsl:choose>
2482
         </xsl:variable>
2483
         <xsl:variable name="depth">
2484
            <xsl:apply-templates mode="depth" select="."/>
2485
         </xsl:variable>
2486
         <p>
2487
            <span class="subtochead">
2488
               <xsl:call-template name="i18n">
2489
                  <xsl:with-param name="word">tocWords</xsl:with-param>
2490
               </xsl:call-template>
2491
            </span>
2492
         </p>
2493
         <div class="subtoc">
2494
            <ul class="subtoc">
2495
               <xsl:for-each select="tei:div|tei:div1|tei:div2|tei:div3|tei:div4|tei:div5|tei:div6">
2496
                  <xsl:variable name="innerdent">
2497
                     <xsl:apply-templates mode="generateLink" select="."/>
2498
                  </xsl:variable>
2499
                  <li class="subtoc">
2500
                     <xsl:call-template name="makeInternalLink">
2501
                        <xsl:with-param name="dest">
2502
                           <xsl:value-of select="$innerdent"/>
2503
                        </xsl:with-param>
2504
                        <xsl:with-param name="class">
2505
                           <xsl:value-of select="$class_subtoc"/>
2506
                        </xsl:with-param>
2507
                        <xsl:with-param name="body">
2508
                           <xsl:call-template name="header">
2509
		                            <xsl:with-param name="display">simple</xsl:with-param>
2510
		                         </xsl:call-template>
2511
                        </xsl:with-param>
2512
                     </xsl:call-template>
2513
                  </li>
2514
               </xsl:for-each>
2515
            </ul>
2516
         </div>
2517
      </xsl:if>
2518
  </xsl:template>
2519
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2520
      <desc>[html] </desc>
2521
   </doc>
2522
  <xsl:template name="summaryToc">
2523
      <div class="teidiv">
2524
         <p>Select headings on the left-hand side to see more explanation of the
2525
        links on the right.</p>
2526
         <table cellspacing="7">
2527
            <thead>
2528
               <tr>
2529
                  <th nowrap="nowrap"/>
2530
                  <th/>
2531
               </tr>
2532
            </thead>
2533
	    <tbody>
2534
            <xsl:for-each select="//tei:body/tei:div">
2535
               <xsl:text>&#10;</xsl:text>
2536
               <tr class="summaryline">
2537
                  <td align="right" class="summarycell" style="vertical-align:top;">
2538
                     <b>
2539
                        <a class="nolink">
2540
                           <xsl:attribute name="href">
2541
                              <xsl:apply-templates mode="generateLink" select="."/>
2542
                           </xsl:attribute>
2543
                           <xsl:value-of select="tei:head"/>
2544
                        </a>
2545
                     </b>
2546
                  </td>
2547
                  <td class="link" style="vertical-align:top;">
2548
                     <xsl:for-each select=".//xref|.//xptr">
2549
                        <xsl:if test="position() &gt; 1">
2550
                           <xsl:text>&#160;</xsl:text>
2551
                           <img alt="*" src="/images/dbluball.gif"/>
2552
                           <xsl:text> </xsl:text>
2553
                        </xsl:if>
2554
                        <span class="nowrap">
2555
                           <xsl:apply-templates select="."/>
2556
                        </span>
2557
                     </xsl:for-each>
2558
                  </td>
2559
               </tr>
2560
            </xsl:for-each>
2561
	    </tbody>
2562
         </table>
2563
      </div>
2564
  </xsl:template>
2565
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2566
      <desc>[html] Make a TOC section <param name="style">CSS style to use</param>
2567
         <param name="id">ID to link to</param>
2568
         <param name="force">whether to force a TOC entry even if other rules
2569
      would normally prevent it</param>
2570
      </desc>
2571
   </doc>
2572
  <xsl:template name="tocSection">
2573
      <xsl:param name="style"/>
2574
      <xsl:param name="id"/>
2575
      <xsl:param name="force">false</xsl:param>
2576
      <xsl:choose>
2577
         <xsl:when test="tei:div1">
2578
            <xsl:for-each select="tei:div1[tei:head or $autoHead='true']">
2579
               <xsl:call-template name="tocEntry">
2580
                  <xsl:with-param name="style" select="$style"/>
2581
                  <xsl:with-param name="id" select="$id"/>
2582
               </xsl:call-template>
2583
            </xsl:for-each>
2584
         </xsl:when>
2585
         <xsl:when test="tei:div2 and (number($splitLevel) &gt;=1 or $force='true')">
2586
            <xsl:for-each select="tei:div2[tei:head or $autoHead='true']">
2587
               <xsl:call-template name="tocEntry">
2588
                  <xsl:with-param name="style" select="$style"/>
2589
                  <xsl:with-param name="id" select="$id"/>
2590
               </xsl:call-template>
2591
            </xsl:for-each>
2592
         </xsl:when>
2593
         <xsl:when test="tei:div3 and (number($splitLevel) &gt;=2 or $force='true')">
2594
            <xsl:for-each select="tei:div3[tei:head or $autoHead='true']">
2595
               <xsl:call-template name="tocEntry">
2596
                  <xsl:with-param name="style" select="$style"/>
2597
                  <xsl:with-param name="id" select="$id"/>
2598
               </xsl:call-template>
2599
            </xsl:for-each>
2600
         </xsl:when>
2601
         <xsl:when test="self::tei:div">
2602
            <xsl:variable name="depth">
2603
               <xsl:apply-templates mode="depth" select="."/>
2604
            </xsl:variable>
2605
            <xsl:if test="(number($splitLevel)&gt;number($depth)  or $force='true' or ancestor::tei:TEI/@rend='nosplit')">
2606
               <xsl:for-each select="tei:div[tei:head or $autoHead='true']">
2607
                  <xsl:call-template name="tocEntry">
2608
                     <xsl:with-param name="style" select="$style"/>
2609
                     <xsl:with-param name="id" select="$id"/>
2610
                  </xsl:call-template>
2611
               </xsl:for-each>
2612
            </xsl:if>
2613
         </xsl:when>
2614
         <xsl:otherwise>
2615
            <xsl:for-each select="tei:div[tei:head or $autoHead='true']">
2616
               <xsl:call-template name="tocEntry">
2617
                  <xsl:with-param name="style" select="$style"/>
2618
                  <xsl:with-param name="id" select="$id"/>
2619
               </xsl:call-template>
2620
            </xsl:for-each>
2621
         </xsl:otherwise>
2622
      </xsl:choose>
2623
  </xsl:template>
2624
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2625
      <desc>[html] Make a TOC entry <param name="style">style</param>
2626
         <param name="id">id</param>
2627
      </desc>
2628
   </doc>
2629
  <xsl:template name="tocEntry">
2630
      <xsl:param name="style"/>
2631
      <xsl:param name="id"/>
2632
      <xsl:element name="{$tocElement}">
2633
         <xsl:attribute name="class">
2634
            <xsl:value-of select="$style"/>
2635
            <xsl:apply-templates mode="depth" select="."/>
2636
         </xsl:attribute>
2637
         <xsl:choose>
2638
            <xsl:when test="generate-id(.)=$id">
2639
               <span class="toclist-this">
2640
                  <xsl:call-template name="header">
2641
	                    <xsl:with-param name="display">simple</xsl:with-param>
2642
	                 </xsl:call-template>
2643
               </span>
2644
            </xsl:when>
2645
            <xsl:otherwise>
2646
               <a>
2647
                  <xsl:attribute name="class">
2648
                     <xsl:value-of select="$style"/>
2649
                  </xsl:attribute>
2650
                  <xsl:attribute name="href">
2651
                     <xsl:apply-templates mode="generateLink" select="."/>
2652
                  </xsl:attribute>
2653
                  <xsl:call-template name="header">
2654
		    <xsl:with-param name="display">simple</xsl:with-param>
2655
		  </xsl:call-template>
2656
               </a>
2657
            </xsl:otherwise>
2658
         </xsl:choose>
2659
         <xsl:text>&#10;</xsl:text>
2660
         <xsl:call-template name="tocSection">
2661
            <xsl:with-param name="style" select="$style"/>
2662
            <xsl:with-param name="id" select="$id"/>
2663
            <xsl:with-param name="force">
2664
               <xsl:if test="generate-id(.)=$id">true</xsl:if>
2665
            </xsl:with-param>
2666
         </xsl:call-template>
2667
      </xsl:element>
2668
  </xsl:template>
2669
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2670
      <desc>[html] </desc>
2671
   </doc>
2672
  <xsl:template name="topNavigation">
2673
      <xsl:if test="ancestor::teiCorpus">
2674
	<xsl:element name="{if ($outputTarget='html5') then 'nav' else 'div'}">	  
2675
	  <xsl:attribute name="class" select="$alignNavigationPanel"/>
2676
	    <xsl:call-template name="nextLink"/>
2677
	    <xsl:call-template name="previousLink"/>
2678
	    <xsl:call-template name="upLink">
2679
	      <xsl:with-param name="up" select="concat($masterFile,$standardSuffix)"/>
2680
	      <xsl:with-param name="title">
2681
		<xsl:call-template name="contentsWord"/>
2682
	      </xsl:with-param>
2683
	    </xsl:call-template>
2684
	</xsl:element>
2685
      </xsl:if>
2686
  </xsl:template>
2687
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2688
      <desc>[html] <param name="up">the link to which "Up" goes</param>
2689
         <param name="title">the text of the link</param>
2690
      </desc>
2691
   </doc>
2692
  <xsl:template name="upLink">
2693
      <xsl:param name="up"/>
2694
      <xsl:param name="title"/>
2695
      <xsl:if test="$up">
2696
         <span class="upLink">
2697
	           <xsl:text> </xsl:text>
2698
	           <xsl:call-template name="i18n">
2699
               <xsl:with-param name="word">upWord</xsl:with-param>
2700
            </xsl:call-template>
2701
	           <xsl:call-template name="navInterSep"/>
2702
         </span>
2703
         <a class="navigation">
2704
	           <xsl:choose>
2705
	              <xsl:when test="$title">
2706
	                 <xsl:attribute name="href">
2707
	                    <xsl:value-of select="$up"/>
2708
	                 </xsl:attribute>
2709
	                 <xsl:value-of select="$title"/>
2710
	              </xsl:when>
2711
	              <xsl:otherwise>
2712
	                 <xsl:attribute name="href">
2713
	                    <xsl:apply-templates mode="generateLink" select="$up"/>
2714
	                 </xsl:attribute>
2715
	                 <xsl:for-each select="$up">
2716
	                    <xsl:call-template name="headerLink">
2717
		                      <xsl:with-param name="minimal" select="$minimalCrossRef"/>
2718
	                    </xsl:call-template>
2719
	                 </xsl:for-each>
2720
	              </xsl:otherwise>
2721
	           </xsl:choose>
2722
         </a>
2723
      </xsl:if>
2724
  </xsl:template>
2725
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2726
      <desc>[html] <param name="path">path</param>
2727
         <param name="class">class</param>
2728
         <param name="whole">whole</param>
2729
      </desc>
2730
   </doc>
2731
  <xsl:template name="walkTree">
2732
      <xsl:param name="path"/>
2733
      <xsl:param name="class"/>
2734
      <xsl:param name="whole"/>
2735
      <xsl:choose>
2736
         <xsl:when test="contains($path,'/')">
2737
            <xsl:variable name="current">
2738
               <xsl:value-of select="substring-before($path,'/')"/>
2739
            </xsl:variable>
2740
            <xsl:variable name="rest">
2741
               <xsl:value-of select="substring-after($path,'/')"/>
2742
            </xsl:variable>
2743
            <xsl:call-template name="aCrumb">
2744
               <xsl:with-param name="crumbBody">
2745
                  <xsl:choose>
2746
                     <xsl:when test="$rest='index.xsp' and $requestedID=''">
2747
                        <xsl:value-of select="$current"/>
2748
                     </xsl:when>
2749
                     <xsl:when test="$rest='index.xml' and $requestedID=''">
2750
                        <xsl:value-of select="$current"/>
2751
                     </xsl:when>
2752
                     <xsl:otherwise>
2753
                        <a class="{$class}">
2754
			  <xsl:attribute name="href">
2755
			    <xsl:value-of select="$whole"/>
2756
			    <xsl:value-of select="$current"/>
2757
			    <xsl:text>/</xsl:text>
2758
			  </xsl:attribute>
2759
			  <xsl:value-of select="$current"/>
2760
                        </a>
2761
                     </xsl:otherwise>
2762
                  </xsl:choose>
2763
               </xsl:with-param>
2764
            </xsl:call-template>
2765
            <xsl:call-template name="walkTree">
2766
               <xsl:with-param name="class">
2767
                  <xsl:value-of select="$class"/>
2768
               </xsl:with-param>
2769
               <xsl:with-param name="path" select="$rest"/>
2770
               <xsl:with-param name="whole">
2771
	                 <xsl:value-of select="$whole"/>
2772
	                 <xsl:value-of select="$current"/>
2773
	                 <xsl:text>/</xsl:text>
2774
	              </xsl:with-param>
2775
            </xsl:call-template>
2776
         </xsl:when>
2777
         <xsl:otherwise>
2778
            <xsl:if test="not($path='index.xsp' or $path='index.xml')">
2779
               <xsl:call-template name="aCrumb">
2780
                  <xsl:with-param name="crumbBody">
2781
                     <a class="{$class}">
2782
		       <xsl:attribute name="href">
2783
			 <xsl:value-of select="$whole"/>
2784
			 <xsl:value-of select="$path"/>
2785
		       </xsl:attribute>
2786
		       <xsl:value-of select="$path"/>
2787
                     </a>
2788
                  </xsl:with-param>
2789
               </xsl:call-template>
2790
            </xsl:if>
2791
         </xsl:otherwise>
2792
      </xsl:choose>
2793
  </xsl:template>
2794
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2795
      <desc>[html] </desc>
2796
   </doc>
2797
  <xsl:template name="writeDiv">
2798
      <xsl:variable name="BaseFile">
2799
         <xsl:value-of select="$masterFile"/>
2800
         <xsl:call-template name="addCorpusID"/>
2801
      </xsl:variable>
2802
      <html>
2803
         <xsl:call-template name="addLangAtt"/>
2804
         <xsl:comment>THIS IS A GENERATED FILE. DO NOT EDIT (2)</xsl:comment>
2805
         <head>
2806
            <xsl:variable name="pagetitle">
2807
               <xsl:call-template name="generateDivtitle"/>
2808
            </xsl:variable>
2809
            <title>
2810
               <xsl:value-of select="$pagetitle"/>
2811
            </title>
2812
            <xsl:call-template name="headHook"/>
2813
            <xsl:call-template name="metaHTML">
2814
               <xsl:with-param name="title" select="$pagetitle"/>
2815
            </xsl:call-template>
2816
            <xsl:call-template name="includeCSS"/>
2817
            <xsl:call-template name="cssHook"/>
2818
            <xsl:call-template name="includeJavascript"/>
2819
            <xsl:call-template name="javascriptHook"/>
2820
         </head>
2821
         <body id="TOP">
2822
            <xsl:call-template name="bodyMicroData"/>
2823
            <xsl:call-template name="bodyJavascriptHook"/>
2824
	    <xsl:call-template name="bodyHook"/>
2825
            <div class="teidiv">
2826
               <xsl:call-template name="stdheader">
2827
                  <xsl:with-param name="title">
2828
		    <xsl:call-template name="header"/>
2829
                  </xsl:with-param>
2830
               </xsl:call-template>
2831
               <xsl:if test="$topNavigationPanel='true'">
2832
		 <xsl:element name="{if ($outputTarget='html5') then 'nav' else 'div'}">
2833
		   <xsl:call-template name="xrefpanel">
2834
		     <xsl:with-param name="homepage" select="concat($BaseFile,$standardSuffix)"/>
2835
                     <xsl:with-param name="mode" select="local-name(.)"/>
2836
                  </xsl:call-template>
2837
		 </xsl:element>
2838
               </xsl:if>
2839
               <xsl:if test="$subTocDepth &gt;= 0">
2840
                  <xsl:call-template name="subtoc"/>
2841
               </xsl:if>
2842
               <xsl:call-template name="startHook"/>
2843
               <xsl:call-template name="doDivBody"/>
2844
               <xsl:call-template name="printNotes"/>
2845
               <xsl:if test="$bottomNavigationPanel='true'">
2846
		 <xsl:element name="{if ($outputTarget='html5') then 'nav' else 'div'}">
2847
                  <xsl:call-template name="xrefpanel">
2848
                     <xsl:with-param name="homepage" select="concat($BaseFile,$standardSuffix)"/>
2849
                     <xsl:with-param name="mode" select="local-name(.)"/>
2850
                  </xsl:call-template>
2851
		 </xsl:element>
2852
               </xsl:if>
2853
               <xsl:call-template name="stdfooter"/>
2854
	              <xsl:call-template name="bodyEndHook"/>
2855
            </div>
2856
         </body>
2857
      </html>
2858
  </xsl:template>
2859
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2860
      <desc>[html]provide a class attribute and/or ID for each div <param name="depth">depth of section (1, 2 3, 4 etc)</param>
2861
      </desc>
2862
   </doc>
2863
  <xsl:template name="divClassAttribute">
2864
      <xsl:param name="depth"/>
2865
      <xsl:if test="@its:dir">
2866
	<xsl:attribute name="dir" select="@its:dir"/>
2867
      </xsl:if>
2868
      <xsl:attribute name="class">
2869
         <xsl:choose>
2870
	   <xsl:when test="@type">
2871
	     <xsl:value-of select="@type"/>
2872
	   </xsl:when>
2873
	   <xsl:otherwise>
2874
	     <xsl:text>teidiv</xsl:text>
2875
	     <xsl:value-of select="$depth"/>
2876
	   </xsl:otherwise>
2877
         </xsl:choose>
2878
         <xsl:if test="@rend">
2879
	   <xsl:text> </xsl:text>
2880
	   <xsl:value-of select="@rend"/>
2881
         </xsl:if>
2882
      </xsl:attribute>
2883
      <xsl:variable name="ident">
2884
         <xsl:apply-templates mode="ident" select="."/>
2885
      </xsl:variable>
2886
      <xsl:attribute name="id">
2887
         <xsl:value-of select="$ident"/>
2888
      </xsl:attribute>
2889
  </xsl:template>
2890
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2891
      <desc>[html] <param name="homepage">homepage</param>
2892
         <param name="mode">mode</param>
2893
      </desc>
2894
   </doc>
2895
  <xsl:template name="xrefpanel">
2896
      <xsl:param name="homepage"/>
2897
      <xsl:param name="mode"/>
2898
      <xsl:attribute name="class" select="$alignNavigationPanel"/>
2899
      <xsl:call-template name="generateUpLink"/>
2900
      <xsl:if test="not(ancestor-or-self::tei:TEI[@rend='nomenu'])">
2901
	<xsl:call-template name="previousLink"/>
2902
	<xsl:call-template name="nextLink"/>
2903
      </xsl:if>
2904
  </xsl:template>
2905

    
2906
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
2907
      <desc>[html] </desc>
2908
   </doc>
2909
  <xsl:template match="tei:floatingText">
2910
      <div class="floatingText">
2911
	        <xsl:for-each select="tei:front">
2912
	           <div class="floatingText_front">
2913
	              <xsl:apply-templates/>
2914
	           </div>
2915
	        </xsl:for-each>
2916
	        <xsl:for-each select="tei:body">
2917
	           <div class="floatingText_body">
2918
	              <xsl:apply-templates/>
2919
	           </div>
2920
	        </xsl:for-each>
2921
	        <xsl:for-each select="tei:back">
2922
	           <div class="floatingText_back">
2923
	              <xsl:apply-templates/>
2924
	           </div>
2925
	        </xsl:for-each>
2926
      </div>
2927
  </xsl:template>
2928

    
2929
  <xsl:template match="tei:trailer">
2930
      <div class="trailer">
2931
	<xsl:apply-templates/>
2932
      </div>
2933
  </xsl:template>
2934

    
2935
</xsl:stylesheet>