Statistics
| Revision:

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

History | View | Annotate | Download (20.6 kB)

1
<?xml version="1.0" encoding="utf-8"?>
2
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" 
3
                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
4
                xmlns:fo="http://www.w3.org/1999/XSL/Format"
5
                xmlns:html="http://www.w3.org/1999/xhtml"
6
		xmlns:xs="http://www.w3.org/2001/XMLSchema"                
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:xsl="http://www.w3.org/1999/XSL/Transform"
11
                version="2.0"
12
                exclude-result-prefixes="a fo rng tei html teix xs">
13
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
14
      <desc>
15
         <p> TEI stylesheet dealing with elements from the linking module,
16
      making HTML output. </p>
17
         <p>This software is dual-licensed:
18

    
19
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
20
Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
21

    
22
2. http://www.opensource.org/licenses/BSD-2-Clause
23
		
24
All rights reserved.
25

    
26
Redistribution and use in source and binary forms, with or without
27
modification, are permitted provided that the following conditions are
28
met:
29

    
30
* Redistributions of source code must retain the above copyright
31
notice, this list of conditions and the following disclaimer.
32

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

    
37
This software is provided by the copyright holders and contributors
38
"as is" and any express or implied warranties, including, but not
39
limited to, the implied warranties of merchantability and fitness for
40
a particular purpose are disclaimed. In no event shall the copyright
41
holder or contributors be liable for any direct, indirect, incidental,
42
special, exemplary, or consequential damages (including, but not
43
limited to, procurement of substitute goods or services; loss of use,
44
data, or profits; or business interruption) however caused and on any
45
theory of liability, whether in contract, strict liability, or tort
46
(including negligence or otherwise) arising in any way out of the use
47
of this software, even if advised of the possibility of such damage.
48
</p>
49
         <p>Author: See AUTHORS</p>
50
         <p>Id: $Id: linking.xsl 10055 2012-01-20 18:46:11Z rahtz $</p>
51
         <p>Copyright: 2011, TEI Consortium</p>
52
      </desc>
53
   </doc>
54
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
55
      <desc>Process any element and work out a unique identififying string</desc>
56
   </doc>
57
  <xsl:template match="*" mode="ident">
58
      <xsl:variable name="BaseFile">
59
         <xsl:value-of select="$masterFile"/>
60
         <xsl:call-template name="addCorpusID"/>
61
      </xsl:variable>
62

    
63
      <xsl:choose>
64
         <xsl:when test="@xml:id and $useIDs='true'">
65
            <xsl:value-of select="@xml:id"/>
66
         </xsl:when>
67
         <xsl:when test="starts-with(local-name(.),'div') or
68
			 self::tei:text">
69
            <xsl:variable name="xpath">
70
               <xsl:for-each select="ancestor-or-self::tei:*">
71
	                 <xsl:value-of select="local-name()"/>
72
	                 <xsl:text>.</xsl:text>
73
	                 <xsl:number/>
74
	                 <xsl:if test="not(position() = last())">
75
	                    <xsl:text>_</xsl:text>
76
	                 </xsl:if>
77
	              </xsl:for-each>
78
	           </xsl:variable>
79
	           <xsl:value-of select="$BaseFile"/>
80
	           <xsl:text>-</xsl:text>
81
            <xsl:value-of select="substring-after(substring-after($xpath,'_text.'),'_')"/>
82
         </xsl:when>
83
         <xsl:when test="self::tei:TEI and parent::tei:teiCorpus">
84
	   <xsl:value-of select="$masterFile"/>
85
	   <xsl:call-template name="addCorpusID"/>
86
	 </xsl:when>
87
         <xsl:otherwise>
88
	   <xsl:value-of select="$BaseFile"/>
89
	   <xsl:text>-</xsl:text>
90
	   <xsl:value-of select="local-name(.)"/>
91
	   <xsl:text>-</xsl:text>
92
	   <xsl:value-of select="generate-id()"/>
93
         </xsl:otherwise>
94
      </xsl:choose>
95
  </xsl:template>
96
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
97
      <desc>Process elements *</desc>
98
   </doc>
99
  <xsl:template match="*" mode="generateLink">
100
      <xsl:variable name="ident">
101
         <xsl:apply-templates mode="ident" select="."/>
102
      </xsl:variable>
103
      <xsl:variable name="depth">
104
         <xsl:apply-templates mode="depth" select="."/>
105
      </xsl:variable>
106
      <xsl:variable name="Hash">
107
         <xsl:text>#</xsl:text>
108
      </xsl:variable>
109
      <xsl:variable name="result">
110
      <xsl:choose>
111
	<xsl:when test="$filePerPage='true'">
112
	  <xsl:choose>
113
	    <xsl:when test="preceding::tei:pb">
114
	      <xsl:apply-templates select="preceding::tei:pb[1]"
115
				   mode="ident"/>
116
	    </xsl:when>
117
	    <xsl:otherwise>
118
	      <xsl:text>index</xsl:text>
119
	    </xsl:otherwise>
120
	  </xsl:choose>
121
	  <xsl:value-of select="$standardSuffix"/>
122
	</xsl:when>
123
         <xsl:when test="$STDOUT='true' and number($depth) &lt;= number($splitLevel)">
124
            <xsl:value-of select="$masterFile"/>
125
            <xsl:value-of select="$standardSuffix"/>
126
            <xsl:value-of select="$urlChunkPrefix"/>
127
            <xsl:value-of select="$ident"/>
128
         </xsl:when>
129
         <xsl:when test="ancestor::tei:elementSpec and not($STDOUT='true')">
130
	           <xsl:text>ref-</xsl:text>
131
	           <xsl:value-of select="ancestor::tei:elementSpec/@ident"/>
132
            <xsl:value-of select="$standardSuffix"/>
133
	           <xsl:value-of select="concat($Hash,$ident)"/>
134
         </xsl:when>
135
         <xsl:when test="ancestor::tei:classSpec and not($STDOUT='true')">
136
	           <xsl:text>ref-</xsl:text>
137
	           <xsl:value-of select="ancestor::tei:classSpec/@ident"/>
138
            <xsl:value-of select="$standardSuffix"/>
139
	           <xsl:value-of select="concat($Hash,$ident)"/>
140
         </xsl:when>
141
         <xsl:when test="ancestor::tei:back and not($splitBackmatter)">
142
            <xsl:value-of select="concat($Hash,$ident)"/>
143
         </xsl:when>
144
         <xsl:when test="ancestor::tei:front and not($splitFrontmatter)">
145
            <xsl:value-of select="concat($Hash,$ident)"/>
146
         </xsl:when>
147
	 <xsl:when test="self::tei:text and $splitLevel=0">
148
	   <xsl:value-of select="$ident"/>
149
	   <xsl:value-of select="$standardSuffix"/>
150
	 </xsl:when>
151
         <xsl:when test="number($splitLevel)= -1 and
152
			 ancestor::tei:teiCorpus">
153
            <xsl:value-of select="$masterFile"/>
154
            <xsl:call-template name="addCorpusID"/>
155
            <xsl:value-of select="$standardSuffix"/>
156
            <xsl:value-of select="concat($Hash,$ident)"/>
157
         </xsl:when>
158
         <xsl:when test="number($splitLevel)= -1">
159
            <xsl:value-of select="concat($Hash,$ident)"/>
160
         </xsl:when>
161
         <xsl:when test="number($depth) &lt;= number($splitLevel)">
162
            <xsl:value-of select="concat($ident,$standardSuffix)"/>
163
         </xsl:when>
164
         <xsl:otherwise>
165
            <xsl:variable name="parent">
166
               <xsl:call-template name="locateParentDiv"/>
167
            </xsl:variable>
168
            <xsl:choose>
169
               <xsl:when test="$STDOUT='true'">
170
                  <xsl:value-of select="$masterFile"/>
171
                  <xsl:value-of select="$urlChunkPrefix"/>
172
                  <xsl:value-of select="$parent"/>
173
                  <xsl:text>#</xsl:text>
174
                  <xsl:value-of select="$ident"/>
175
               </xsl:when>
176
               <xsl:otherwise>
177
                  <xsl:value-of select="$parent"/>
178
                  <xsl:value-of select="concat($standardSuffix,'#')"/>
179
                  <xsl:value-of select="$ident"/>
180
               </xsl:otherwise>
181
            </xsl:choose>
182
         </xsl:otherwise>
183
      </xsl:choose>
184
</xsl:variable>
185
<!--
186
<xsl:message><xsl:value-of select="$ident"/>: <xsl:value-of
187
select="$depth"/>: <xsl:value-of select="$splitLevel"/>: <xsl:value-of
188
select="$result"/></xsl:message>
189
-->
190
<xsl:value-of select="$result"/>
191
  </xsl:template>
192
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
193
      <desc>
194
         <p>Process element TEI in generateLink mode</p>
195
         <p>
196
            <p xmlns="http://www.w3.org/1999/xhtml"> when a &lt;div&gt; is referenced, see whether its plain
197
        anchor, or needs a parent HTML name prepended </p>
198
         </p>
199
      </desc>
200
   </doc>
201
  <xsl:template match="tei:TEI" mode="generateLink">
202
      <xsl:variable name="BaseFile">
203
	<xsl:apply-templates select="." mode="ident"/>
204
      </xsl:variable>
205
      <xsl:value-of select="concat($BaseFile,$standardSuffix)"/>
206
  </xsl:template>
207
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
208
      <desc>Process element anchor</desc>
209
   </doc>
210
  <xsl:template match="tei:anchor">
211
      <xsl:call-template name="makeAnchor"/>
212
  </xsl:template>
213
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
214
      <desc>Process extra elements in generateLink mode</desc>
215
   </doc>
216
  <xsl:template match="tei:label|tei:figure|tei:table|tei:item|tei:p|tei:bibl|tei:anchor|tei:cell|tei:lg|tei:list|tei:sp"
217
                 mode="generateLink">
218
      <xsl:variable name="ident">
219
         <xsl:apply-templates mode="ident" select="."/>
220
      </xsl:variable>
221
      <xsl:variable name="file">
222
         <xsl:apply-templates mode="generateLink"
223
                              select="ancestor::tei:*[starts-with(local-name(),'div')][1]"/>
224
      </xsl:variable>
225
      <xsl:choose>
226
         <xsl:when test="starts-with($file,'#')">
227
            <xsl:text>#</xsl:text>
228
            <xsl:value-of select="$ident"/>
229
         </xsl:when>
230
         <xsl:when test="contains($file,'#')">
231
            <xsl:value-of select="substring-before($file,'#')"/>
232
            <xsl:text>#</xsl:text>
233
            <xsl:value-of select="$ident"/>
234
         </xsl:when>
235
         <xsl:otherwise>
236
            <xsl:value-of select="$file"/>
237
            <xsl:text>#</xsl:text>
238
            <xsl:value-of select="$ident"/>
239
         </xsl:otherwise>
240
      </xsl:choose>
241
  </xsl:template>
242
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
243
      <desc>Process element note</desc>
244
   </doc>
245
  <xsl:template match="tei:note" mode="generateLink">
246
    <xsl:variable name="file">
247
      <xsl:apply-templates mode="generateLink"
248
			   select="ancestor::tei:*[starts-with(local-name(),'div')][1]"/>
249
    </xsl:variable>
250
    <xsl:choose>
251
      <xsl:when test="starts-with($file,'#')"/>
252
      <xsl:when test="contains($file,'#')">
253
            <xsl:value-of select="substring-before($file,'#')"/>
254
         </xsl:when>
255
         <xsl:otherwise>
256
            <xsl:value-of select="$file"/>
257
         </xsl:otherwise>
258
      </xsl:choose>
259
      <xsl:text>#</xsl:text>
260
      <xsl:call-template name="noteID"/>
261
  </xsl:template>
262
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
263
      <desc>[html] <param name="where">where</param>
264
      </desc>
265
   </doc>
266
  <xsl:template name="generateEndLink">
267
      <xsl:param name="where"/>
268
      <xsl:choose>
269
	<xsl:when test="id($where)">
270
	  <xsl:apply-templates mode="generateLink" select="id($where)"/>
271
	</xsl:when>
272
	<xsl:otherwise>
273
	  <xsl:text>[[undefined </xsl:text>
274
	  <xsl:value-of select="$where"/>
275
	  <xsl:text>]]</xsl:text>
276
	</xsl:otherwise>
277
      </xsl:choose>
278
  </xsl:template>
279

    
280
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
281
      <desc>[html] Find the name of the outermost container for the
282
      current object which would create an output file</desc>
283
   </doc>
284
  <xsl:template name="locateParentDiv">
285

    
286
      <xsl:choose>
287

    
288
	<xsl:when
289
	     test="ancestor-or-self::tei:body/parent::tei:text/ancestor::tei:group">
290
            <xsl:apply-templates mode="ident" select="ancestor::tei:text[1]"/>
291
         </xsl:when>
292

    
293
	 <xsl:when test="ancestor-or-self::tei:front/parent::tei:text/ancestor::tei:group">
294
            <xsl:apply-templates mode="ident" select="ancestor::tei:text[1]"/>
295
         </xsl:when>
296

    
297
	 <xsl:when test="ancestor-or-self::tei:back/parent::tei:text/ancestor::tei:group">
298
            <xsl:apply-templates mode="ident" select="ancestor::tei:text[1]"/>
299
         </xsl:when>
300

    
301
         <xsl:when test="ancestor-or-self::tei:div and number($splitLevel) &lt; 0">
302
            <xsl:apply-templates mode="ident" select="ancestor::tei:div[last()]"/>
303
         </xsl:when>
304

    
305
         <xsl:when test="ancestor-or-self::tei:div">
306
	   <xsl:variable name="ancestors" select="count(ancestor-or-self::tei:div)"/>
307
	   <xsl:variable name="diff" select="$ancestors - number($splitLevel)"/>
308
	   <xsl:variable name="what" select="if ($diff &lt;= 1) then 1
309
					     else $diff "/>
310
	   <xsl:apply-templates mode="ident" select="ancestor-or-self::tei:div[$what]"/>
311
         </xsl:when>
312

    
313
         <xsl:otherwise>
314
	   <xsl:variable name="ancestors" select="count(ancestor::tei:*[local-name()='div1'
315
				 or local-name()='div2'
316
				 or local-name()='div3'
317
				 or local-name()='div4'
318
				 or local-name()='div5'
319
				 or local-name()='div6'])"/>
320
	   <xsl:variable name="what"
321
			 select="if
322
				 ($ancestors &lt; number($splitLevel)) then 1 else
323
				 $ancestors - number($splitLevel) +1"/>
324
            <xsl:apply-templates mode="ident"
325
				 select="ancestor-or-self::tei:*[local-name()='div1'
326
				 or local-name()='div2'
327
				 or local-name()='div3'
328
				 or local-name()='div4'
329
				 or local-name()='div5'
330
				 or local-name()='div6'][$what]"/>
331
         </xsl:otherwise>
332
      </xsl:choose>
333

    
334
  </xsl:template>
335
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
336
      <desc>[html] create external link<param name="ptr">ptr</param>
337
         <param name="dest">dest</param>
338
         <param name="class">class</param>
339
      </desc>
340
   </doc>
341
  <xsl:template name="makeExternalLink">
342
      <xsl:param name="ptr" as="xs:boolean"  select="false()"/>
343
      <xsl:param name="dest"/>
344
      <xsl:param name="class">link_<xsl:value-of select="local-name(.)"/>
345
      </xsl:param>
346
      <a>
347
        <xsl:choose>
348
            <xsl:when test="@rend">
349
	              <xsl:attribute name="class">
350
	                 <xsl:value-of select="@rend"/>
351
	              </xsl:attribute>
352
            </xsl:when>
353
	           <xsl:when test="@rendition">
354
	              <xsl:call-template name="applyRendition"/>
355
	           </xsl:when>
356
            <xsl:when test="parent::tei:item/parent::tei:list[@rend]">
357
	              <xsl:attribute name="class">
358
	                 <xsl:value-of select="parent::tei:item/parent::tei:list/@rend"/>
359
	              </xsl:attribute>
360
            </xsl:when>
361
	           <xsl:when test="parent::tei:item[@rend]">
362
	              <xsl:attribute name="class">
363
	                 <xsl:value-of select="parent::tei:item/@rend"/>
364
	              </xsl:attribute>
365
            </xsl:when>
366
            <xsl:otherwise>
367
	              <xsl:attribute name="class">
368
	                 <xsl:value-of select="$class"/>
369
	              </xsl:attribute>
370
            </xsl:otherwise>
371
        </xsl:choose>
372

    
373
         <xsl:if test="@type">
374
            <xsl:attribute name="type">
375
               <xsl:value-of select="@type"/>
376
            </xsl:attribute>
377
         </xsl:if>
378
         <xsl:attribute name="href">
379
            <xsl:value-of select="$dest"/>
380
            <xsl:if test="contains(@from,'id (')">
381
               <xsl:text>#</xsl:text>
382
               <xsl:value-of select="substring(@from,5,string-length(normalize-space(@from))-1)"/>
383
            </xsl:if>
384
         </xsl:attribute>
385
	 <xsl:choose>
386
	   <xsl:when test="@n">
387
	     <xsl:attribute name="title">
388
	       <xsl:value-of select="@n"/>
389
	     </xsl:attribute>
390
	   </xsl:when>
391
	 </xsl:choose>
392
         <xsl:call-template name="xrefHook"/>
393
         <xsl:choose>
394
	   <xsl:when test="$dest=''">??</xsl:when>
395
            <xsl:when test="$ptr">
396
               <xsl:element name="{$urlMarkup}">
397
                  <xsl:choose>
398
                     <xsl:when test="starts-with($dest,'mailto:')">
399
                        <xsl:value-of select="substring-after($dest,'mailto:')"/>
400
                     </xsl:when>
401
                     <xsl:when test="starts-with($dest,'file:')">
402
                        <xsl:value-of select="substring-after($dest,'file:')"/>
403
                     </xsl:when>
404
                     <xsl:otherwise>
405
                        <xsl:value-of select="$dest"/>
406
                     </xsl:otherwise>
407
                  </xsl:choose>
408
               </xsl:element>
409
            </xsl:when>
410
            <xsl:otherwise>
411
               <xsl:apply-templates/>
412
            </xsl:otherwise>
413
         </xsl:choose>
414
      </a>
415
  </xsl:template>
416
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
417
      <desc>[html] create an internal link<param name="target">target</param>
418
         <param name="ptr">ptr</param>
419
         <param name="dest">dest</param>
420
         <param name="body">body</param>
421
         <param name="class">class</param>
422
      </desc>
423
   </doc>
424
  <xsl:template name="makeInternalLink">
425
      <xsl:param name="target"/>
426
      <xsl:param name="ptr" as="xs:boolean" select="false()"/>
427
      <xsl:param name="dest"/>
428
      <xsl:param name="body"/>
429
      <xsl:param name="class">
430
         <xsl:text>link_</xsl:text>
431
         <xsl:value-of select="local-name(.)"/>
432
      </xsl:param>
433
      <xsl:variable name="W">
434
         <xsl:choose>
435
            <xsl:when test="$target">
436
               <xsl:value-of select="$target"/>
437
            </xsl:when>
438
            <xsl:when test="contains($dest,'#')">
439
               <xsl:value-of select="substring-after($dest,'#')"/>
440
            </xsl:when>
441
            <xsl:otherwise>
442
               <xsl:value-of select="$dest"/>
443
            </xsl:otherwise>
444
         </xsl:choose>
445
      </xsl:variable>
446

    
447
      <xsl:choose>
448
         <xsl:when test="$dest=''">
449
            <xsl:choose>
450
               <xsl:when test="not($body='')">
451
                  <xsl:value-of select="$body"/>
452
               </xsl:when>
453
               <xsl:when test="$ptr">
454
                  <xsl:apply-templates mode="xref" select="id($W)">
455
                     <xsl:with-param name="minimal" select="$minimalCrossRef"/>
456
                  </xsl:apply-templates>
457
               </xsl:when>
458
               <xsl:otherwise>
459
                  <xsl:apply-templates/>
460
               </xsl:otherwise>
461
            </xsl:choose>
462
         </xsl:when>
463
         <xsl:otherwise>
464
	   <xsl:variable name="eventualtarget">
465
	     <xsl:choose>
466
	       <xsl:when test="starts-with($dest,'#') or  contains($dest,$outputSuffix) or contains($dest,'ID=')">
467
		 <xsl:value-of select="$dest"/>
468
	       </xsl:when>
469
	       <xsl:when test="id($W)"/>
470
	       <xsl:otherwise>
471
		 <xsl:apply-templates mode="generateLink" select="id($W)"/>
472
	       </xsl:otherwise>
473
	     </xsl:choose>
474
	   </xsl:variable>
475
	   <xsl:variable name="linktext">
476
	     <xsl:choose>
477
	       <xsl:when test="not($body='')">
478
		 <xsl:value-of select="$body"/>
479
	       </xsl:when>
480
               <xsl:when test="$ptr and @type='footnote'">
481
		 <xsl:text>[</xsl:text>
482
		 <xsl:number level="any"/>
483
		 <xsl:text>]</xsl:text>
484
	       </xsl:when>
485
	       <xsl:when test="$ptr and id($W)">
486
		 <xsl:apply-templates mode="xref" select="id($W)">
487
		   <xsl:with-param name="minimal" select="$minimalCrossRef"/>
488
		 </xsl:apply-templates>
489
	       </xsl:when>
490
	       <xsl:when test="$ptr">
491
		 <xsl:value-of select="$dest"/>
492
	       </xsl:when>
493
	       <xsl:otherwise>
494
		 <xsl:apply-templates/>
495
	       </xsl:otherwise>
496
	     </xsl:choose>
497
	   </xsl:variable>
498
	   <xsl:choose>
499
	     <xsl:when test="$eventualtarget=''">
500
	       <xsl:copy-of select="$linktext"/>
501
	     </xsl:when>
502
	     <xsl:otherwise>
503
	       <a href="{$eventualtarget}">
504
		 <xsl:call-template name="htmlAttributes"/>
505
		 <xsl:choose>
506
		   <xsl:when test="@rend">
507
		     <xsl:attribute name="class">
508
		       <xsl:value-of select="@rend"/>
509
		     </xsl:attribute>
510
		   </xsl:when>
511
		   <xsl:when test="@rendition">
512
		     <xsl:call-template name="applyRendition"/>
513
		   </xsl:when>
514
		   <xsl:when test="string-length($class)=0"/>
515
		   <xsl:otherwise>
516
		     <xsl:attribute name="class">
517
		       <xsl:value-of select="$class"/>
518
		     </xsl:attribute>
519
		   </xsl:otherwise>
520
		 </xsl:choose>
521
		 
522
		 <xsl:for-each select="id($W)">
523
		     <xsl:choose>
524
		       <xsl:when test="starts-with(local-name(.),'div')">
525
			 <xsl:attribute name="title">
526
			   <xsl:value-of
527
			       select="translate(normalize-space(tei:head[1]),'&gt;&lt;','')"/>
528
			 </xsl:attribute>
529
		       </xsl:when>
530
		     </xsl:choose>
531
		 </xsl:for-each>
532
	       <xsl:copy-of select="$linktext"/>
533
	       </a>
534
	     </xsl:otherwise>
535
	   </xsl:choose>
536
         </xsl:otherwise>
537
      </xsl:choose>
538
  </xsl:template>
539

    
540
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
541
      <desc>Process cross-ref to note</desc>
542
   </doc>
543
  <xsl:template match="tei:note" mode="xref">
544
      <xsl:number level="any"/>
545
  </xsl:template>
546

    
547
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
548
      <desc>formatting of the number part of a header</desc>
549
   </doc>
550
  <xsl:template name="formatHeadingNumber">
551
      <xsl:param name="text"/>
552
      <xsl:param name="toc"/>
553
      <xsl:if test="not($text='')">
554
	<span class="headingNumber">
555
	  <xsl:copy-of select="$text"/>
556
	</span>
557
      </xsl:if>
558
  </xsl:template>
559

    
560
</xsl:stylesheet>