Project

General

Profile

Download (64.7 KB) Statistics
| Branch: | Tag: | Revision:
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE xsl:stylesheet [<!ENTITY hyphen "&#45;" > <!ENTITY mdash "&#x2014;" > <!ENTITY multip "&#x2715;" > <!ENTITY ndash "&#x2013;" > <!ENTITY male "&#x2642;" > <!ENTITY female "&#x2640;" > <!ENTITY ndash "&#x2715;" > ]> 
3

    
4
<!--
5
  
6
  CDM XSL Transformation
7
  Target Format: Flore d'Afrique Centrale
8
  
9
-->
10
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:functx="http://www.functx.com" xmlns:msxsl="http://exslt.org/common" xmlns:fn="http://www.w3.org/2005/xpath-functions" 
11
  xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
12
  
13
  
14
  <!--xsl:import href="functx-1.0-doc-2007-01.xsl" /-->
15
  
16
  <xsl:param name="abstract"/>
17
  <xsl:param name="title"/>
18
  
19

    
20
  <!-- ############### Constants and definitions ################### -->
21

    
22
  <!-- **********************************
23
    ** global definitions 
24
    *********************************** -->
25
  <xsl:param name="global-family-font">Times</xsl:param>
26
  <xsl:param name="global-size-font">10pt</xsl:param>
27
  <xsl:param name="global-title-font">10pt</xsl:param>
28
  <xsl:param name="global-line-height">12pt</xsl:param>
29

    
30
  <xsl:param name="global-width-page">159mm</xsl:param>
31
  <xsl:param name="global-height-page">244mm</xsl:param>
32

    
33
  <xsl:param name="global-indentation">0mm</xsl:param>
34

    
35
  <!-- **********************************   
36
    ** definitions for taxon pages
37
    *********************************** -->
38
  <xsl:param name="taxon-first-page-top-margin">66mm</xsl:param>
39
  <xsl:param name="taxon-page-top-margin">32mm</xsl:param>
40
  <xsl:param name="taxon-page-inner-margin">21mm</xsl:param>
41
  <xsl:param name="taxon-page-bottom-margin">32mm</xsl:param>
42
  <xsl:param name="graphic-height">150mm</xsl:param>
43

    
44
  <xsl:param name="taxon-region-body-outer-margin">24mm</xsl:param>
45

    
46
  <xsl:param name="taxon-region-before-extent">0mm</xsl:param>
47
  <xsl:param name="taxon-region-after-extent">0mm</xsl:param>
48

    
49
  <xsl:param name="content-bg-color">white</xsl:param>
50
  <xsl:param name="taxon-header-family-font">Times</xsl:param>
51
  <xsl:param name="taxon-header-before-bg-color">white</xsl:param>
52
  <xsl:param name="taxon-header-after-bg-color">white</xsl:param>
53
  <xsl:param name="taxon-header-size-font">7pt</xsl:param>
54

    
55
  <xsl:param name="distribution-size-font">8pt</xsl:param>
56

    
57
  <xsl:param name="taxon-name-indentation">4mm</xsl:param>
58
  <xsl:param name="taxon-name-size-font">8pt</xsl:param>
59
  <xsl:param name="taxon-name-line-height">9.6pt</xsl:param>
60

    
61
  <xsl:param name="taxon-header-style-font">italic</xsl:param>
62
  <xsl:param name="taxon-header-page-number-size-font">10pt</xsl:param>
63
  <xsl:param name="taxon-header-page-number-align-text">end</xsl:param>
64
  <xsl:param name="taxon-header-page-number-margin">11mm</xsl:param>
65

    
66
  <xsl:param name="taxon-page-number-initial">1</xsl:param>
67

    
68
  <!-- hardcoded ranks -->
69
  <xsl:param name="uuidFamily">af5f2481-3192-403f-ae65-7c957a0f02b6</xsl:param>
70
  <xsl:param name="uuidGenus">1b11c34c-48a8-4efa-98d5-84f7f66ef43a</xsl:param>
71
  <xsl:param name="uuidSubgenus">78786e16-2a70-48af-a608-494023b91904</xsl:param>
72

    
73

    
74
  <!-- **********************************   
75
    ** html support
76
    *********************************** -->
77

    
78
  <!-- format html i tags in text as italic -->
79
  <!--xsl:template match="i">
80
    <fo:inline font-style="italic">
81
      <xsl:value-of select="."/>
82
    </fo:inline>
83
  </xsl:template-->
84

    
85
  <!-- format html b tags in text as bold -->
86
  <xsl:template match="b">
87
    <fo:inline font-weight="bold">
88
      <xsl:apply-templates/>
89
    </fo:inline>
90
  </xsl:template>
91

    
92
  <!-- ########################################################################## -->
93

    
94

    
95
  <!-- start xsl output -->
96
  <xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="no"/>
97
  <xsl:param name="versionParam" select="'1.0'"/>
98

    
99
  <!-- root element: root -->
100
  <xsl:template match="root">
101
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
102

    
103
      <!-- defines page layout -->
104
      <fo:layout-master-set>
105
        
106
        <!-- layout for odd taxon pages -->
107
        <fo:simple-page-master master-name="taxon_page_first" page-height="{$global-height-page}"
108
          page-width="{$global-width-page}" margin-top="{$taxon-first-page-top-margin}"
109
          margin-bottom="{$taxon-page-bottom-margin}" margin-left="{$taxon-page-inner-margin}">
110
          <fo:region-body margin-right="{$taxon-region-body-outer-margin}"/>
111
          <fo:region-before extent="{$taxon-region-before-extent}" region-name="odd-before"/>
112
          <fo:region-after extent="{$taxon-region-after-extent}" region-name="odd-after"/>
113
        </fo:simple-page-master>
114

    
115
        <!-- layout for odd taxon pages -->
116
        <fo:simple-page-master master-name="taxon_page_odd" page-height="{$global-height-page}"
117
          page-width="{$global-width-page}" margin-top="{$taxon-page-top-margin}"
118
          margin-bottom="{$taxon-page-bottom-margin}" margin-left="{$taxon-page-inner-margin}">
119
          <fo:region-body margin-right="{$taxon-region-body-outer-margin}"/>
120
          <fo:region-before extent="{$taxon-region-before-extent}" region-name="odd-before"/>
121
          <fo:region-after extent="{$taxon-region-after-extent}" region-name="odd-after"/>
122
        </fo:simple-page-master>
123

    
124
        <!-- layout for even taxon pages -->
125
        <fo:simple-page-master master-name="taxon_page_even" page-height="{$global-height-page}"
126
          page-width="{$global-width-page}" margin-top="{$taxon-page-top-margin}"
127
          margin-bottom="{$taxon-page-bottom-margin}" margin-left="0"
128
          margin-right="{$taxon-page-inner-margin}">
129
          <fo:region-body margin-left="{$taxon-region-body-outer-margin}"/>
130
          <fo:region-before extent="{$taxon-region-before-extent}" region-name="even-before"/>
131
          <fo:region-after extent="{$taxon-region-after-extent}" region-name="even-after"/>
132

    
133
          <!--fo:leader leader-pattern="rule" leader-length="10mm"/-->
134

    
135
        </fo:simple-page-master>
136

    
137

    
138
        <!-- defines repeatable page-sequence for layout of taxa -->
139
        <fo:page-sequence-master master-name="taxon_page">
140
          <fo:repeatable-page-master-alternatives>
141
            <fo:conditional-page-master-reference master-reference="taxon_page_first"
142
              page-position="first"/>
143
            <fo:conditional-page-master-reference master-reference="taxon_page_even"
144
              page-position="rest" odd-or-even="even"/>
145
            <fo:conditional-page-master-reference master-reference="taxon_page_odd"
146
              page-position="rest" odd-or-even="odd"/>
147
            <!--            <fo:conditional-page-master-reference master-reference="mclBoook_taxon_page_even"
148
              page-position="last"/>-->
149
          </fo:repeatable-page-master-alternatives>
150
        </fo:page-sequence-master>
151
      </fo:layout-master-set>
152
      <!-- end: defines page layout -->
153

    
154
      <!-- page sequence for taxon view -->
155
      <fo:page-sequence master-reference="taxon_page"
156
        initial-page-number="{$taxon-page-number-initial}" force-page-count="no-force">
157

    
158
        <fo:static-content flow-name="odd-before">
159
          <xsl:call-template name="right-extent"/>
160
        </fo:static-content>
161

    
162
        <fo:static-content flow-name="even-before">
163
          <xsl:call-template name="left-extent"/>
164
        </fo:static-content>
165

    
166
        
167
        
168
        <!-- format taxa -->
169
        <fo:flow flow-name="xsl-region-body">
170
          
171
          <!--fo:block><xsl:value-of select="$abstract"/></fo:block-->
172
          
173
          <fo:block font-family="{$global-family-font}" font-size="{$global-size-font}"
174
            line-height="{$global-line-height}" linefeed-treatment="preserve">
175
            
176
            <fo:block text-align="center" font-weight="bold" font-size="global-title-font" linefeed-treatment="preserve">            
177
              <xsl:value-of select="$title"/>
178
              <xsl:text>&#xA;</xsl:text>
179
              <xsl:text>&#xA;</xsl:text>
180
            </fo:block>
181
            <fo:block linefeed-treatment="preserve">
182
            <!--fo:inline font-weight="bold"><xsl:text>Abstract. </xsl:text></fo:inline-->
183
            <xsl:value-of select="$abstract"/>
184
              <xsl:text>&#xA;</xsl:text>
185
              
186
            </fo:block>
187
            <xsl:text>&#xA;</xsl:text>
188
            
189
            <xsl:for-each select="//TaxonNode">
190
              <xsl:apply-templates select="."/>
191
            </xsl:for-each>
192
            
193
            <fo:block text-align="center" text-transform="uppercase" font-weight="bold" linefeed-treatment="preserve">
194
              <xsl:text>&#xA;</xsl:text>
195
              <xsl:text>REFERENCES</xsl:text>             
196
            </fo:block>
197
            <xsl:text>&#xA;</xsl:text>
198
            <xsl:call-template name="References"/>
199
            
200
            <fo:block text-align="center" font-weight="bold" linefeed-treatment="preserve">
201
              <xsl:text>&#xA;</xsl:text>
202
              <xsl:text>Noms scientifiques</xsl:text>             
203
            </fo:block>
204
            <xsl:text>&#xA;</xsl:text>
205
            <xsl:call-template name="scientific-name-index"/>
206
          </fo:block>
207
        </fo:flow>
208
      </fo:page-sequence>
209
    </fo:root>
210
  </xsl:template>
211
  
212
  <!-- TODO shorten this so that not repeating code for creating author in each xsl:when statement -->
213
  <xsl:template name="scientific-name-index">   
214
    <!-- create a variable for the sorted scientific names for the index, then once sorted can select preceding to get the first occurance of 
215
    the genusOrUninomial in the list-->
216
    <xsl:variable name="sortedcopy">
217
      <xsl:for-each select="//name">
218
        <xsl:sort select="genusOrUninomial" data-type="text" order="ascending"></xsl:sort>
219
        <xsl:sort select="specificEpithet" data-type="text" order="ascending"></xsl:sort>
220
        <xsl:copy-of select="."/>       
221
      </xsl:for-each>
222
    </xsl:variable>  
223

    
224
    <fo:block margin-bottom="5mm" text-align="justify">    
225
      <xsl:for-each select="$sortedcopy/*"><!-- or select="//name/genusOrUninomial-->
226
         
227
        <xsl:variable name="genus" select="."/>
228
        <xsl:choose>
229
          <!-- family -->
230
          <xsl:when test="rank/uuid='af5f2481-3192-403f-ae65-7c957a0f02b6'">
231
            <fo:inline font-style="italic">
232
            <xsl:apply-templates select="genusOrUninomial"/>
233
            </fo:inline>
234
            <xsl:for-each select="taggedName/e">
235
              <xsl:if test="type='authors'">
236
                <xsl:text> </xsl:text>
237
                <xsl:value-of select="text"/>
238
              </xsl:if>              
239
            </xsl:for-each>
240
          </xsl:when>
241
          <!-- genus -->
242
          <xsl:when test="rank/uuid='1b11c34c-48a8-4efa-98d5-84f7f66ef43a'">
243
            <fo:block>
244
              <fo:inline font-style="italic">
245
              <xsl:apply-templates select="genusOrUninomial"/>
246
              </fo:inline>
247
              <xsl:for-each select="taggedName/e">
248
                <xsl:if test="type='authors'">
249
                  <xsl:text> </xsl:text>
250
                  <xsl:value-of select="text"/>
251
                </xsl:if>              
252
              </xsl:for-each>
253
            </fo:block>
254
          </xsl:when>
255
          <!-- subgenus -->
256
          <xsl:when test="rank/uuid='78786e16-2a70-48af-a608-494023b91904'">
257
            <fo:block>
258
              <xsl:apply-templates select="rank/representation_L10n"/>
259
              <xsl:text> </xsl:text>
260
              <fo:inline font-style="italic">
261
              <xsl:apply-templates select="genusOrUninomial"/>
262
              </fo:inline>
263
              <xsl:for-each select="taggedName/e">
264
                <xsl:if test="type='authors'">
265
                  <xsl:text> </xsl:text>
266
                  <xsl:value-of select="text"/>
267
                </xsl:if>              
268
              </xsl:for-each>
269
            </fo:block>            
270
          </xsl:when>
271
          <!-- species -->
272
          <xsl:when test="rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d'">
273
            
274
            <!--first occurance of the genusOrUninomial in the list is not indented -->
275
              <xsl:choose>
276
                <xsl:when test="not(preceding::genusOrUninomial[1] = genusOrUninomial)">
277
                <fo:block>
278
                  <fo:inline font-style="italic">
279
                <xsl:apply-templates select="genusOrUninomial"/>
280
                <xsl:text> </xsl:text>
281
                  <xsl:apply-templates select="specificEpithet"/>
282
                  </fo:inline>
283
                  <xsl:text> </xsl:text>
284
                  <!--xsl:apply-templates select="rank/titleCache"/-->
285
                  <xsl:for-each select="taggedName/e">
286
                    <xsl:if test="type='authors'">
287
                      <xsl:text> </xsl:text>
288
                      <xsl:value-of select="text"/>
289
                    </xsl:if>              
290
                  </xsl:for-each>
291
                    
292
                </fo:block>
293
                </xsl:when>
294
                <xsl:otherwise>
295
                  <fo:block text-indent="{$taxon-name-indentation}">
296
                    <fo:inline font-style="italic">
297
                      <xsl:apply-templates select="specificEpithet"/>
298
                    </fo:inline>
299
                      <xsl:text> </xsl:text>
300
                      <!--xsl:apply-templates select="rank/titleCache"/--><!-- for debugging -->
301
                    <xsl:for-each select="taggedName/e">
302
                      <xsl:if test="type='authors'">
303
                        <xsl:text> </xsl:text>
304
                        <xsl:value-of select="text"/>
305
                      </xsl:if>              
306
                    </xsl:for-each>
307
                    </fo:block>
308
                </xsl:otherwise>
309
              </xsl:choose>
310
              
311
            
312
          </xsl:when>
313
          <!-- variant d5feb6a5-af5c-45ef-9878-bb4f36aaf490-->
314
          <xsl:when test="rank/uuid='d5feb6a5-af5c-45ef-9878-bb4f36aaf490'">
315
            <fo:block text-indent="{$taxon-name-indentation}">
316
              <xsl:text>&ndash; </xsl:text> <!--concat ndash-->
317
              <xsl:apply-templates select="rank/representation_L10n_abbreviatedLabel"/>
318
              <xsl:text> </xsl:text>
319
              <fo:inline font-style="italic">
320
              <xsl:apply-templates select="specificEpithet"/>
321
              </fo:inline>
322
              
323
              <xsl:for-each select="taggedName/e">
324
                <xsl:if test="type='authors'">
325
                  <xsl:text> </xsl:text>
326
                  <xsl:value-of select="text"/>
327
                </xsl:if>              
328
              </xsl:for-each>
329
            </fo:block>
330
          </xsl:when>
331
          <!-- sub-species 462a7819-8b00-4190-8313-88b5be81fad5-->
332
          <xsl:when test="rank/uuid='462a7819-8b00-4190-8313-88b5be81fad5'">
333
            <fo:block text-indent="{$taxon-name-indentation}">
334
              <!--xsl:apply-templates select="specificEpithet"/--><!--remove - just for testing -->
335
              <xsl:text>- </xsl:text>
336
              <xsl:apply-templates select="rank/representation_L10n_abbreviatedLabel"/>
337
              <xsl:text> </xsl:text>
338
              <fo:inline font-style="italic">
339
              <xsl:apply-templates select="infraSpecificEpithet"/>
340
              </fo:inline>
341
              <!--xsl:variable name="full-name">
342
              <xsl:apply-templates select="../taggedName"/> we only want to add the authors from taggedName if taggedName/e/type='author' select text
343
              </xsl:variable-->
344
              <!--fo:inline font-style="bold">
345
                <xsl:apply-templates select="$full-name"></xsl:apply-templates>
346
              </fo:inline-->
347
              <!--xsl:apply-templates select="substring-after(' ', $full-name)"></xsl:apply-templates-->
348
              <!--xsl:call-template name="dispay-author-name">
349
                <xsl:with-param name="e" select="../taggedName/e"/>
350
              </xsl:call-template-->
351
              <xsl:for-each select="taggedName/e">
352
                <xsl:if test="type='authors'">
353
                  <xsl:text> </xsl:text>
354
                  <xsl:value-of select="text"/>
355
                </xsl:if>              
356
              </xsl:for-each>
357
            </fo:block>
358
          </xsl:when>
359
          <!--xsl:otherwise-->
360
            <!-- for debugging LORNA DEBUGGING XSLT CHOOSE: <xsl:value-of
361
              select="../rank/uuid"/>: <xsl:value-of select="../titleCache"/>
362
          </xsl:otherwise!-->
363
        </xsl:choose>    
364
      </xsl:for-each>
365
    </fo:block>
366
  </xsl:template>
367
  
368

    
369
  <xsl:template name="dispay-author-name"> <!-- call this template with node e - don't display uninomial for species -->
370
    <xsl:param name="e"/>
371
      <xsl:if test="$e/type='authors'">
372
        <xsl:text>++++++</xsl:text>
373
        <xsl:value-of select="$e/text"/>
374
      </xsl:if>
375
  </xsl:template>
376

    
377
  <!-- HEADER -->
378

    
379
  <xsl:template name="right-extent">
380
    <!--fo:block text-align="center">Page <fo:page-number/>
381
    </fo:block-->
382
    <fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}"
383
      font-size="{$taxon-header-size-font}">
384
      <!-- No pagination at the moment -->
385
      <fo:block font-size="{$taxon-header-page-number-size-font}" font-style="normal"
386
        padding-top="95%" text-align="end">| <fo:page-number padding-right="10%"
387
          border-right-width="11mm"/></fo:block>
388
      <!--text-align="{$taxon-header-page-number-align-text}"> | <fo:page-number/></fo:block> -->
389
      <!--margin-right="{$taxon-region-body-outer-margin}" -->
390
      <!-- &#x2014; -->
391
      <fo:block color="white">-</fo:block>
392
      <fo:block>
393
        <fo:retrieve-marker retrieve-class-name="pageTitleMarker"
394
          retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
395
        <xsl:text> </xsl:text>
396
        <fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker"
397
          retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
398
      </fo:block>
399
    </fo:block>
400
  </xsl:template>
401

    
402
  <xsl:template name="left-extent">
403
    <fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}"
404
      font-size="{$taxon-header-size-font}">
405
      <fo:block font-size="{$taxon-header-page-number-size-font}" font-style="normal"
406
        padding-top="95%" text-align="start"><fo:page-number padding-left="10%"
407
          border-right-width="11mm"/> |</fo:block>
408
      <!-- No pagination at the moment
409
      <fo:block font-size="{$taxon-header-page-number-size-font}"
410
        text-align="{$taxon-header-page-number-align-text}"> &#x2014; <fo:page-number/> &#x2014;
411
        </fo:block> -->
412
    </fo:block>
413
  </xsl:template>
414

    
415
  <!--xsl:template name="odd-after-header">
416
    <fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}"
417
      font-size="{$taxon-header-size-font}">
418
      <fo:block>
419
        <fo:inline>
420
          <fo:retrieve-marker retrieve-class-name="pageTitleMarker"
421
            retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
422
          <fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker"
423
            retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
424
        </fo:inline>
425
      </fo:block>
426
    </fo:block>
427
  </xsl:template-->
428

    
429

    
430
  <!--xsl:template name="even-before-header">
431
    <fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}"
432
      font-size="{$taxon-header-size-font}"-->
433
  <!--
434
      No pagination at the moment  
435
      <fo:block color="white" font-size="{$taxon-header-page-number-size-font}">-</fo:block>
436
      <fo:block color="white">-</fo:block>-->
437
  <!--  
438
    <fo:block>
439
        <fo:inline>
440
          <fo:retrieve-marker retrieve-class-name="pageTitleMarker"
441
            retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
442
          <fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker"
443
            retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
444
        </fo:inline>
445
      </fo:block>
446
    </fo:block>
447

    
448
  </xsl:template-->
449

    
450
  <xsl:template name="even-after-header">
451
    <fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}"
452
      font-size="{$taxon-header-size-font}">
453
      <fo:block>
454
        <fo:inline>
455
          <fo:retrieve-marker retrieve-class-name="pageTitleMarker"
456
            retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
457
          <fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker"
458
            retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
459
        </fo:inline>
460
      </fo:block>
461
      <!-- No pagination at the moment
462
      <fo:block color="white">-</fo:block>
463
      <fo:block font-size="{$taxon-header-page-number-size-font}"
464
        text-align="{$taxon-header-page-number-align-text}"> &#x2014; <fo:page-number/> &#x2014;
465
        </fo:block> -->
466
    </fo:block>
467
  </xsl:template>
468

    
469
  <!-- GENERAL -->
470

    
471
  <xsl:template match="TaxonNode" name="TaxonNode">
472
    <xsl:apply-templates select="Taxon"/>
473
  </xsl:template>
474

    
475
  <xsl:template match="Taxon" name="Taxon">
476
    <xsl:call-template name="title"/>
477
    <xsl:apply-templates select="synonymy"/>
478
    <xsl:apply-templates select="descriptions"/>
479
    <xsl:apply-templates select="key"/>
480
  </xsl:template>
481

    
482

    
483
  <xsl:template name="title">
484
    <fo:block margin-bottom="5mm" keep-together.within-page="always" keep-with-next="always">
485
      <!-- we need to find a way to store the uuid in a variable xsl:parameter did not work or i was using it wrong -->
486
      <xsl:choose>
487
        <!-- family -->
488
        <xsl:when test="name/rank/uuid='af5f2481-3192-403f-ae65-7c957a0f02b6'">
489
          <fo:block font-weight="bold" text-align="center" text-transform="uppercase">
490
            <xsl:apply-templates select="name/genusOrUninomial"/>
491
            <xsl:text> FAMILY</xsl:text>
492
          </fo:block>
493
        </xsl:when>
494
        <!-- genus -->
495
        <xsl:when test="name/rank/uuid='1b11c34c-48a8-4efa-98d5-84f7f66ef43a'">
496
          <fo:block font-weight="bold" text-align="center" text-transform="uppercase">
497
            <xsl:apply-templates select="name/genusOrUninomial"/>
498
          </fo:block>
499
        </xsl:when>
500
        <!-- subgenus -->
501
        <xsl:when test="name/rank/uuid='78786e16-2a70-48af-a608-494023b91904'">
502
          <fo:block font-weight="bold" text-align="center">
503
            <xsl:apply-templates select="name/rank/representation_L10n"/>
504
            <xsl:text> </xsl:text>
505
            <xsl:apply-templates select="name/genusOrUninomial"/>
506
          </fo:block>
507
        </xsl:when>
508
        <!-- species -->
509
        <xsl:when test="name/rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d'">
510
          <fo:block font-weight="bold" text-align="center">
511
            <xsl:apply-templates select="name/genusOrUninomial"/>
512
            <xsl:text> </xsl:text>
513
            <xsl:apply-templates select="name/specificEpithet"/>
514
          </fo:block>
515
        </xsl:when>
516
        <xsl:otherwise>
517
          <!-- for debugging --> Unformatted title for rank uuid: <xsl:value-of
518
            select="name/rank/uuid"/>: <xsl:value-of select="name/titleCache"/>
519
        </xsl:otherwise>
520
      </xsl:choose>
521
    </fo:block>
522
  </xsl:template>
523

    
524
  <!-- NAME -->
525

    
526
  <xsl:template match="name">
527
    <xsl:apply-templates select="taggedName"/>
528
    <xsl:apply-templates select="nomenclaturalReference"/>
529
  </xsl:template>
530

    
531
  <xsl:template match="taggedName">
532
    <xsl:for-each select="e">
533
      <xsl:choose>
534
        <xsl:when test="type='name'">
535
          <fo:inline font-style="italic">
536
            <xsl:value-of select="text"/>
537
          </fo:inline>
538
          <xsl:text> </xsl:text>
539
        </xsl:when>
540
        <xsl:when test="type='authors'">
541
          <xsl:value-of select="text"/>
542
        </xsl:when>
543
        <xsl:otherwise>
544
          <xsl:value-of select="text"/>
545
          <xsl:text> </xsl:text>
546
        </xsl:otherwise>
547
      </xsl:choose>
548
    </xsl:for-each>
549
  </xsl:template>
550
 
551

    
552
  <!-- first date in brackets -->
553
  <xsl:template match="nomenclaturalReference">
554
    <xsl:text> (</xsl:text>
555
    <fo:inline>
556
      <xsl:value-of select="authorship/titleCache"/>
557
      <xsl:text> </xsl:text>
558
      <xsl:value-of select="datePublished/start"/>: </fo:inline>
559
    <xsl:text> </xsl:text>
560
    <fo:inline>
561
      <xsl:value-of select="../nomenclaturalMicroReference"/>
562
    </fo:inline>
563
    <xsl:text>)</xsl:text>
564
  </xsl:template>
565

    
566
  <!-- DESCRIPTIONS -->
567

    
568
  <xsl:template match="descriptions" name="descriptions">
569
    <xsl:for-each select="features/feature">
570
      <xsl:choose>
571
        <xsl:when test="count(feature)!=0">
572
          <xsl:call-template name="secondLevelDescriptionElements"/>
573
        </xsl:when>
574
        <xsl:otherwise>
575
          <!-- everything except Citation -->
576
          <xsl:if test="uuid!='99b2842f-9aa7-42fa-bd5f-7285311e0101'">
577
            <xsl:call-template name="descriptionElements"/>
578
          </xsl:if>
579
          <!--xsl:apply-templates select="media/e/representations/e/parts/e/uri"/-->
580
        </xsl:otherwise>
581
      </xsl:choose>
582
    </xsl:for-each>
583
  </xsl:template>
584

    
585
  <xsl:template name="descriptionElements">
586
    <xsl:choose>
587
      <xsl:when test="supportsCommonTaxonName='true'">
588
        <!-- for example Vernacular Name -->
589
        <xsl:call-template name="commonTaxonName"/>
590
      </xsl:when>
591
      <xsl:otherwise>
592
        <!-- for example Habitat, Material Examined -->
593
        <xsl:call-template name="textData"/>
594
      </xsl:otherwise>
595
    </xsl:choose>
596
  </xsl:template>
597

    
598
  <xsl:template name="secondLevelDescriptionElements">
599
    <fo:block text-align="justify" margin-bottom="5mm">
600
      <!--fo:external-graphic src='http://lully.snv.jussieu.fr/xper2AppletThumbnailsMaker/sdd/images/ant_anatomy2.jpg'/-->
601
      <xsl:for-each select="feature">
602

    
603
        <xsl:variable name="representation" select="representation_L10n"/>
604
        <xsl:if test="not(starts-with($representation, 'Material'))">
605
          <!--xsl:if test="not(starts-with($representation, 'Figures'))"-->
606
          <fo:inline keep-with-next.within-line="always">
607

    
608
            <xsl:if test="not(starts-with($representation, 'Figures'))">
609
              <!-- The headings are in English - do we want to remove them altogether or have French headings -->
610
              <!--fo:inline text-decoration="underline" keep-with-next.within-line="always">
611

    
612
                <xsl:value-of select="representation_L10n"/>
613
              </fo:inline>
614
              <fo:inline>: </fo:inline-->
615
            </xsl:if>
616

    
617
            <xsl:for-each select="descriptionelements/descriptionelement">
618

    
619
              <xsl:variable name="desc_element_text" select="multilanguageText_L10n/text"/>
620

    
621
              <!-- filter out repeated description element text. Lorna - could do this in the CDM so it doesn't occur in the XML but not sure why it's happening-->
622
              <xsl:variable name="prev_desc_element_text"
623
                select="preceding-sibling::descriptionelement[1]/multilanguageText_L10n/text"/>
624

    
625
              <fo:inline font-size="9pt" space-after="5mm">
626

    
627
                <xsl:if test="not(starts-with($desc_element_text, 'Figure'))">
628

    
629
                  <!--xsl:apply-templates select="multilanguageText_L10n/text"/-->
630
                  <!-- Might need this filtering for Ericaceae, but Restionaceae seems ok without -->
631
                  <!--xsl:value-of select="multilanguageText_L10n/text"></xsl:value-of-->
632
                  <xsl:apply-templates select="multilanguageText_L10n/text"/>
633
                  
634
                  <!--xsl:choose>
635
                    <xsl:when test="position() = 1">
636
                      <xsl:apply-templates select="multilanguageText_L10n/text"/>
637
                    </xsl:when>
638
                    <xsl:otherwise>
639
                      <xsl:if test="$desc_element_text != $prev_desc_element_text"-->
640
                        <!-- checked in the tax editor and looks like only descriptionelement[1] refers to the species so don't need below-->
641
                        <!-- comment in for restionaceae but not for ericaceae - why? -->
642
                        <!--xsl:apply-templates select="multilanguageText_L10n/text"/>
643
                      </xsl:if>
644
                    </xsl:otherwise>
645
                  </xsl:choose-->
646

    
647
                </xsl:if>
648

    
649
              </fo:inline>
650

    
651
              <!--xsl:apply-templates select="multilanguageText_L10n/text"/-->
652
              <!--xsl:apply-templates select="media"/-->
653

    
654
              <!--TODO Lorna we need to work out which description element contains the uri node for each figure 
655
            and place it next to the appropriate taxon in the output-->
656

    
657
              <!--xsl:if test="not(starts-with($representation, 'Figures'))"-->
658
              <!--xsl:if test="position() = 1"-->
659
                <!--xsl:value-of select="../../../../../../Taxon/name/titleCache"/-->
660
              
661
             <!-- if it has the title map don't show it in the image section -->
662

    
663
              <xsl:if test="not(starts-with(media/e/title_L10n,'Map'))">
664
                <xsl:apply-templates select="media/e/representations/e/parts/e/uri"/>
665
              </xsl:if>
666
              
667
              
668
              
669
              
670
              <!--xsl:call-template name="uri">
671
                <xsl:with-param name="uri-node" select="media/e/representations/e/parts/e/uri"/>
672
              </xsl:call-template-->
673
              <!--/xsl:if-->
674
              <!--xsl:apply-templates select="e[1]/name[1]/homotypicalGroup[1]/typifiedNames[1]/e/taxonBases[1]/e/descriptions[1]/e/elements[1]/e[1]/media[1]/e/representations[1]/e/parts[1]/e/uri"></xsl:apply-templates-->
675

    
676
            </xsl:for-each>
677

    
678
            <xsl:text> </xsl:text>
679
          </fo:inline>
680
        </xsl:if>
681
        <!--/xsl:if-->
682
      </xsl:for-each>
683

    
684
    </fo:block>
685

    
686
  </xsl:template>
687

    
688
  <!-- IMAGES -->
689
  
690
  <xsl:template match="uri">
691
    <!--xsl:template name="uri"-->
692
    
693
    <xsl:param name="uri-node"/>
694
    <xsl:variable name="graphic" select="."/>
695
    <xsl:variable name="title" select="../../../../../title_L10n"/>
696
    <!--fo:block text-align="center"-->
697
    <fo:block keep-together.within-page="always"> 
698

    
699
      <!--xsl:variable name="graphic" select="e/representations/e/parts/e/uri"/-->
700

    
701
      <!-- Is there a description element of type Figure for this TaxonNode?-->
702
   
703
      <xsl:choose>        
704
        <!--xsl:when test="contains($graphic,'jpg')"-->
705
        <!-- this is temporary to include the Maps as images for Quentin, in the longer term we'll generate the maps using the web service-->
706
        <xsl:when test="starts-with($title,'Map')">
707
          <fo:block keep-with-next="always" text-align="center">
708
            
709
            <!--fo:inline text-align="center"-->
710
            <fo:external-graphic content-height="scale-to-fit" height="50mm"
711
              scaling="uniform" src="{$graphic}" padding-before="30" padding-after="2"
712
              display-align="center"/>
713
            <!--/fo:inline-->
714
          </fo:block>
715
        </xsl:when>
716
        <xsl:otherwise>
717
         
718
          <fo:block keep-with-next="always" text-align="center">
719
            
720
            <!--fo:inline text-align="center"-->
721
            <fo:external-graphic content-height="scale-to-fit" height="{$graphic-height}"
722
              scaling="uniform" src="{$graphic}" padding-before="30" padding-after="2"
723
              display-align="center"/>
724
            <!--/fo:inline-->
725
          </fo:block>
726
          <fo:block>
727
            <fo:leader leader-pattern="rule" leader-alignment="{$taxon-page-inner-margin}"
728
              rule-thickness="0.8pt" leader-length="114mm"/>
729
            
730
          </fo:block>
731
        </xsl:otherwise>
732
      </xsl:choose>
733

    
734
    <!--fo:block-->
735

    
736
      <!--fo:leader leader-pattern="rule" leader-length="120mm"/-->
737
      <fo:inline font-size="{$taxon-name-size-font}">
738
        <!--go back up to the description element and get the text for the Figure legend -->
739
        <xsl:apply-templates select="../../../../../../../multilanguageText_L10n/text"/>
740
      </fo:inline>
741
    </fo:block>
742
  </xsl:template>
743

    
744

    
745
  <xsl:template match="text">
746
    <!--fo:block font-size="9pt" space-after="5mm" -->
747
    <!--xsl:apply-templates select="node()"/-->
748
    <!--xsl:call-template name="add-markup">
749
      <xsl:with-param name="str" select="."/>
750

    
751
      <xsl:with-param name="tag-name" select="b"/>
752
    </xsl:call-template-->
753
    <xsl:choose>
754

    
755
      <xsl:when test="contains(.,&quot;&lt;b&gt;&quot;)">
756
        <xsl:call-template name="add-markup">
757
          <xsl:with-param name="str" select="."/>
758
          <!--xsl:with-param name="tag-name" select="b"/-->
759
          <xsl:with-param name="tag-name">b</xsl:with-param>
760
        </xsl:call-template>
761
      </xsl:when>
762
      <xsl:otherwise>
763
        <xsl:choose>
764
        <xsl:when test="contains(.,&quot;&lt;sup&gt;&quot;)">
765
        <xsl:call-template name="add-markup">
766
          <xsl:with-param name="str" select="."/>
767
          <xsl:with-param name="tag-name">sup</xsl:with-param>
768
        </xsl:call-template>
769
        </xsl:when>
770
          <xsl:otherwise>
771
            <xsl:call-template name="add-markup">
772
              <xsl:with-param name="str" select="."/>
773
              <xsl:with-param name="tag-name">i</xsl:with-param>
774
            </xsl:call-template>
775
          </xsl:otherwise>
776
        </xsl:choose>
777
        
778
      </xsl:otherwise>
779
    </xsl:choose>
780

    
781
    <!--/fo:block -->
782
  </xsl:template>
783

    
784
  <!-- TODO Can this template be made shorter by less nesting in the xsl:choose statements -->
785
  <xsl:template name="add-markup">
786
    <xsl:param name="str"/>
787
    <xsl:param name="tag-name"/>
788
    
789
    <xsl:variable name="opening-tag">
790
      <xsl:value-of select="concat('&lt;', $tag-name, '&gt;')"> </xsl:value-of>
791
    </xsl:variable>
792
    <xsl:variable name="closing-tag">
793
      <xsl:value-of select="concat('&lt;/', $tag-name, '&gt;')"> </xsl:value-of>
794
    </xsl:variable>
795
    <xsl:variable name="before-tag" select="substring-before($str, $opening-tag)"/>
796
    
797
    <xsl:choose>
798
      <xsl:when test="contains($str, $opening-tag)">
799
        <!--xsl:variable name="before-tag" select="substring-before($str, $opening-tag)"/-->
800
        <xsl:variable name="inside-tag"
801
          select="substring-before(substring-after($str,$opening-tag),$closing-tag)"/>
802
        <xsl:variable name="after-tag" select="substring-after($str, $closing-tag)"/>
803
          <xsl:choose>        
804
            <xsl:when test="contains($before-tag, '#x')">
805
              <xsl:call-template name="replace-symbols">
806
                <xsl:with-param name="str" select="$before-tag"/>
807
                <xsl:with-param name="tag-name" select="$tag-name"/>
808
              </xsl:call-template>
809
            </xsl:when>         
810
            <xsl:otherwise>
811
              <!--Remaining string contains no further symbols-->
812
              <xsl:value-of select="$before-tag"/>
813
            </xsl:otherwise>                 
814
          </xsl:choose>
815
        
816
        <!-- add BOLD or italics when inside the appropriate tags -->
817
        <xsl:choose>
818
          <xsl:when test="$tag-name = 'b'">
819
            <fo:inline font-weight="bold">
820
              <xsl:value-of select="$inside-tag"/>
821
            </fo:inline>
822
          </xsl:when>
823
          <xsl:otherwise>
824
            <xsl:choose>
825
              <xsl:when test="$tag-name = 'i'">
826
            <fo:inline font-style="italic">
827
              <xsl:value-of select="$inside-tag"/>
828
            </fo:inline>
829
              </xsl:when>
830
              <xsl:otherwise>
831
                <xsl:if test="$tag-name = 'sup'">
832
                <fo:inline vertical-align="super" font-size="8pt">
833
                  <xsl:value-of select="$inside-tag"/>
834
                </fo:inline>
835
                </xsl:if>
836
              </xsl:otherwise>
837
            </xsl:choose>
838

    
839
          </xsl:otherwise>
840
        </xsl:choose>
841
        <!-- call template recursively with the remaining text after the tag -->
842
        <xsl:call-template name="add-markup">
843
          <xsl:with-param name="str" select="$after-tag"/>
844
          <xsl:with-param name="tag-name" select="$tag-name"/>
845
        </xsl:call-template>
846
      </xsl:when>
847
      <xsl:otherwise>               
848
        <xsl:choose>        
849
          <xsl:when test="contains($str, '#x')">
850
            <xsl:call-template name="replace-symbols">
851
              <xsl:with-param name="str" select="$str"/>
852
              <xsl:with-param name="tag-name" select="$tag-name"/>
853
            </xsl:call-template>
854
          </xsl:when>         
855
          <xsl:otherwise>
856
            <!--Remaining string contains no further symbols-->
857
            <xsl:value-of select="$str"/>
858
          </xsl:otherwise>                 
859
        </xsl:choose>
860
      </xsl:otherwise>
861
    </xsl:choose>
862
  </xsl:template>
863
  
864
  <xsl:template name="replace-symbols">
865
    <xsl:param name="str"/>
866
    <xsl:param name="tag-name"/>
867
    <!--xsl:value-of select="replace($str,$pattern, $new-pattern)"></xsl:value-of-->
868
    <!--xsl:value-of select="concat(substring-before($str,'#x'), 'hello', substring($str, '#x'), 'bye')"></xsl:value-of-->
869
    <!--Replace symbols -->
870
    <xsl:variable name="stringStart"><xsl:value-of select="substring-before($str,'#x')"></xsl:value-of></xsl:variable>
871
    <xsl:variable name="stringLength"><xsl:value-of select="string-length($stringStart)"></xsl:value-of></xsl:variable>
872
    <xsl:call-template name="replace-string">
873
      <xsl:with-param name="text" select="concat($stringStart, substring($str, $stringLength+1, 8))"/> 
874
      <xsl:with-param name="replace" select="substring($str, $stringLength, 8)" /> 
875
    </xsl:call-template>                                           
876
    
877
    <xsl:call-template name="add-markup">
878
      <xsl:with-param name="str" select="substring($str, $stringLength+8)"/>
879
      <xsl:with-param name="tag-name" select="$tag-name"/>
880
    </xsl:call-template>
881
  </xsl:template>
882
  
883
  <!-- Perhaps we can make this more generic rather than test for each string to replace -->
884
  <xsl:template name="replace-string">
885
    <xsl:param name="text"/>
886
    <xsl:param name="replace"/>
887
    <!--xsl:param name="with"/-->
888
    <xsl:value-of select="substring-before($text,$replace)"/>     
889
          <xsl:choose>
890
            <xsl:when test="contains($text, '#x2642;')">              
891
              <fo:inline font-family="Arial">
892
                <xsl:value-of select="'&male;'"/> 
893
              </fo:inline>
894
            </xsl:when>
895
            <xsl:otherwise>
896
              <xsl:choose>
897
                <xsl:when test="contains($text, '#x2640;')">
898
                  <fo:inline font-family="Arial">
899
                    <xsl:value-of select="'&female;'"/>
900
                  </fo:inline>
901
                </xsl:when>
902
                <xsl:otherwise>
903
                  <xsl:choose>
904
                    <xsl:when test="contains($text, '#x2013;')">
905
                      <fo:inline font-family="Arial">
906
                        <xsl:value-of select="'&ndash;'"/>
907
                      </fo:inline>
908
                    </xsl:when>
909
                    <xsl:otherwise>
910
                      <xsl:choose>
911
                        <xsl:when test="contains($text, '#x2014;')">
912
                          <fo:inline font-family="Arial">
913
                            <xsl:value-of select="'&mdash;'"/>
914
                          </fo:inline>
915
                        </xsl:when>
916
                        <xsl:otherwise>
917
                          <xsl:if test="contains($text, '#x2715;')">
918
                            <fo:inline font-family="Segoe UI Symbol">
919
                              <xsl:value-of select="'&multip;'"/>
920
                            </fo:inline>
921
                          </xsl:if>
922
                        </xsl:otherwise>
923
                      </xsl:choose>
924
                      
925
                    </xsl:otherwise>
926
                  </xsl:choose>
927
                </xsl:otherwise>
928
              </xsl:choose>
929
            </xsl:otherwise>
930
          </xsl:choose>                          
931
  </xsl:template>
932

    
933
  <xsl:template name="remove_ampersands">
934
    <xsl:param name="str"/>
935
    <xsl:choose>
936
      <xsl:when test="contains($str,&quot;amp;&quot;)"> </xsl:when>
937
    </xsl:choose>
938
  </xsl:template>
939

    
940
  <xsl:template name="remove">
941
    <xsl:param name="value"/>
942
    <xsl:value-of select="concat(substring-before($value, 'amp;'), substring-after($value, 'amp;'))"
943
    />
944
  </xsl:template>
945

    
946
  <!--xsl:template match="i">
947
    <fo:inline font-style="italic">
948
      <xsl:apply-templates select="node()"/>
949
    </fo:inline>
950
  </xsl:template-->
951

    
952
  <xsl:template match="i">
953
    <fo:inline font-style="italic">
954
      <xsl:apply-templates/>
955
    </fo:inline>
956
  </xsl:template>
957

    
958
  <xsl:template match="i//text()">
959
    <fo:inline font-style="italic">
960
      <xsl:apply-templates/>
961
    </fo:inline>
962
  </xsl:template>
963

    
964

    
965
  <xsl:template name="commonTaxonName">
966
    <fo:inline font-weight="bold">
967
      <xsl:value-of select="representation_L10n"/>
968
    </fo:inline>
969
    <xsl:text> &mdash; </xsl:text>
970
    <xsl:for-each select="descriptionelements/descriptionelement">
971
      <fo:inline>
972
        <xsl:choose>
973
          <xsl:when test="position() != last()">
974
            <xsl:value-of select="name"/> (<xsl:value-of select="language/representation_L10n"/>), </xsl:when>
975
          <xsl:otherwise>
976
            <xsl:value-of select="name"/> (<xsl:value-of select="language/representation_L10n"
977
            />).</xsl:otherwise>
978
        </xsl:choose>
979
      </fo:inline>
980
    </xsl:for-each>
981
  </xsl:template>
982

    
983
  <xsl:template name="commonTaxonNameold2">
984
    <fo:inline font-weight="bold">
985
      <xsl:value-of select="representation_L10n"/>
986
    </fo:inline>
987
    <xsl:text> &mdash; </xsl:text>
988
    <xsl:for-each select="descriptionelements/descriptionelement">
989
      <fo:inline>
990
        <xsl:value-of select="name"/> (<xsl:value-of select="language/representation_L10n"/>) <xsl:choose>
991
          <xsl:when test="position() != last()">,</xsl:when>
992
          <xsl:otherwise>.</xsl:otherwise>
993
        </xsl:choose>
994
      </fo:inline>
995
    </xsl:for-each>
996
  </xsl:template>
997

    
998
  <xsl:template name="commonTaxonNameold">
999
    <fo:inline font-weight="bold">
1000
      <xsl:value-of select="representation_L10n"/>
1001
    </fo:inline>
1002
    <xsl:text> &mdash; </xsl:text>
1003
    <xsl:for-each select="descriptionelements/descriptionelement">
1004
      <fo:inline>
1005
        <xsl:value-of select="name"/> (<xsl:value-of select="language/representation_L10n"/>),
1006
      </fo:inline>
1007
    </xsl:for-each>
1008
  </xsl:template>
1009

    
1010
  <xsl:template name="textData">
1011
    <fo:block text-align="justify" margin-bottom="5mm" keep-together.within-page="always">
1012
      <!-- show all feature headlines except "ditribution" -->
1013
      <!--xsl:if test="uuid!='9fc9d10c-ba50-49ee-b174-ce83fc3f80c6'">
1014
        <fo:inline font-weight="bold">
1015
          <xsl:value-of select="representation_L10n"/>
1016
        </fo:inline>
1017
        <xsl:text> – </xsl:text>
1018
      </xsl:if-->
1019
      <xsl:choose>
1020
        <!-- 9fc9d10c-ba50-49ee-b174-ce83fc3f80c6 is Distribution -->
1021
        <xsl:when test="uuid!='9fc9d10c-ba50-49ee-b174-ce83fc3f80c6'">
1022
          <fo:inline font-weight="bold">
1023
            <xsl:value-of select="representation_L10n"/>
1024
            <!-- e.g. Habitat -->
1025
          </fo:inline>
1026
          <xsl:text> &mdash; </xsl:text>
1027
        </xsl:when>
1028
        <xsl:otherwise>
1029
          <fo:inline font-weight="bold" keep-with-next="always">
1030
            <xsl:text> Matériel examiné </xsl:text>
1031
            <xsl:text>&#xA;</xsl:text>
1032
          </fo:inline>
1033
        </xsl:otherwise>
1034

    
1035
      </xsl:choose>
1036
      <!--xsl:for-each select="descriptionelements/descriptionelement">
1037
        <fo:inline>
1038
          <xsl:text>LINE 609</xsl:text>
1039
          <xsl:apply-templates select="multilanguageText_L10n/text"/>
1040
        </fo:inline>
1041
      </xsl:for-each-->
1042

    
1043
      <!-- LORNA TRY IMAGE HERE -->
1044
      <!--xsl:apply-templates select="descriptionelements/descriptionelement[1]/media/e/representations/e/parts/e/uri"/-->
1045

    
1046
      <!--xsl:apply-templates select="descriptionelements/descriptionelement[1]/multilanguageText_L10n/text"/-->
1047
      <!--Restionaceae -occurs in the second descrptionelement so select descriptionelement instead of descriptionelement[1]-->
1048
      <xsl:apply-templates select="descriptionelements/descriptionelement/multilanguageText_L10n/text"/><xsl:text>&#160;</xsl:text>
1049
      
1050
      <!-- get the map associated with the distribution, this is temporarily stored as a media object jpg created by 
1051
        Quentin's GIS software -->
1052
      <xsl:if test="uuid='9fc9d10c-ba50-49ee-b174-ce83fc3f80c6'">
1053
        
1054
        <!-- get the map attached to the feature 'Figures' - temporary solution - we will generatee the map using the web service-->
1055
        <xsl:if test="starts-with(../feature/feature/representation_L10n[.='Figures']/../descriptionelements/descriptionelement[1]/media/e/title_L10n,'Map')">
1056
          <xsl:apply-templates select="../feature/feature/representation_L10n[.='Figures']/../descriptionelements/descriptionelement[1]/media/e/representations/e/parts/e/uri"/>
1057
        </xsl:if>
1058
        
1059
      </xsl:if>
1060
      
1061
    </fo:block>
1062
  </xsl:template>
1063

    
1064
  <xsl:template match="key" name="key">
1065
    <!--fo:block margin-bottom="5mm" line-height="{$taxon-name-line-height}" font-size="{$taxon-name-size-font}"-->
1066
    <fo:block linefeed-treatment="preserve">
1067

    
1068
      <fo:block font-weight="bold" text-align="center">
1069
        <xsl:value-of select="HashMap/titleCache"/>
1070
      </fo:block>
1071
      <xsl:if test="HashMap/records/e">
1072
        <xsl:text>&#xA;</xsl:text>
1073
        <fo:table>
1074
          <fo:table-column column-width="5mm"/>
1075
          <fo:table-column column-width="5mm"/>
1076
          <fo:table-column column-width="69mm"/>
1077
          <fo:table-column column-width="36mm"/>
1078
          <fo:table-body>
1079
            <!--xsl:if test="ArrayList/e"-->
1080
            <xsl:for-each select="HashMap/records/e">
1081

    
1082
              <!-- TaxonLinkDto or PolytomousKeyNodeLinkDto-->
1083
              <fo:table-row>
1084
                <fo:table-cell>
1085
                  <fo:block>
1086
                    <xsl:if test="edgeNumber = 1">
1087
                      <xsl:value-of select="nodeNumber"/>
1088
                      <xsl:text>.</xsl:text>
1089
                    </xsl:if>
1090
                  </fo:block>
1091
                </fo:table-cell>
1092
                <fo:table-cell>
1093
                  <fo:block>&ndash;</fo:block>
1094
                </fo:table-cell>
1095
                <fo:table-cell>
1096
                  <!--fo:block>
1097
                    <xsl:apply-templates select="childStatement"/-->
1098
                  <!--xsl:value-of select="concat(childStatement, '..............')"/-->
1099
                  <!--xsl:text>.......................................................................................</xsl:text>
1100
                  </fo:block-->
1101
                  <fo:block text-align="justify" text-align-last="justify">
1102
                    <!-- leader-length="auto"-->
1103
                    <xsl:value-of select="childStatement"/>
1104
                    <xsl:text> </xsl:text>
1105
                    <fo:leader leader-pattern="dots"/>
1106
                  </fo:block>
1107

    
1108
                </fo:table-cell>
1109
                <fo:table-cell display-align="after">
1110
                  <fo:block font-style="italic" text-align="justify" text-align-last="justify">
1111
                    <!-- leader-length="auto" text-align="right"-->
1112
                    <fo:leader leader-pattern="dots"/>
1113
                    <xsl:choose>
1114
                      <xsl:when test="links/e[1]/class = 'PolytomousKeyNodeLinkDto'">
1115
                        <xsl:value-of select="links/e[1]/nodeNumber"/>
1116
                      </xsl:when>
1117
                      <xsl:when test="links/e[1]/class = 'TaxonLinkDto'">
1118
                        <xsl:variable name="taxonUuid" select="links/e[1]/uuid"/>
1119
                        <xsl:variable name="genus"
1120
                          select="//Taxon/uuid[.=$taxonUuid]/../name/genusOrUninomial"/>
1121
                        <xsl:choose>
1122
                          <xsl:when test="taxonUuid = $uuidSubgenus">
1123
                            <xsl:variable name="repr"
1124
                              select="//Taxon/uuid[.='71cd0e8d-47eb-4c66-829a-e21c705ee660']/../name/rank/representation_L10n"/>
1125
                            <!--xsl:value-of select="concat($substring($genus,1,1), '. ', $repr)"/-->
1126
                            <xsl:value-of select="concat($genus, '. ', $repr)"/>
1127
                          </xsl:when>
1128
                          <xsl:when test="taxonUuid = $uuidGenus">
1129
                            <fo:block font-weight="bold" text-align="center"
1130
                              text-transform="uppercase">
1131
                              <xsl:apply-templates select="$genus"/>
1132
                            </fo:block>
1133
                          </xsl:when>
1134
                          <xsl:otherwise>
1135
                            <xsl:variable name="specificEpithet"
1136
                              select="//Taxon/uuid[.=$taxonUuid]/../name/specificEpithet"/>
1137
                            <!-- abbreviate the genus for species names -->
1138
                            <!--xsl:value-of select="concat(substring($genus,1,1), '. ', $specificEpithet)"/-->
1139
                            <xsl:value-of select="concat($genus, '. ', $specificEpithet)"/>
1140
                          </xsl:otherwise>
1141
                        </xsl:choose>
1142
                      </xsl:when>
1143
                      <xsl:otherwise/>
1144
                    </xsl:choose>
1145
                  </fo:block>
1146
                </fo:table-cell>
1147
              </fo:table-row>
1148
            </xsl:for-each>
1149

    
1150
          </fo:table-body>
1151
        </fo:table>
1152
        <fo:leader leader-pattern="rule" leader-length="100%"/>
1153
        <xsl:text>&#xA;</xsl:text>
1154
      </xsl:if>
1155
      <!-- new line for the end of the section -->
1156
      <xsl:text>&#xA;</xsl:text>
1157
    </fo:block>
1158
  </xsl:template>
1159

    
1160

    
1161
  <!-- SYNONYMY BLOCK -->
1162

    
1163
  <xsl:template match="synonymy" name="synonymy">
1164
    <fo:block margin-bottom="5mm" line-height="{$taxon-name-line-height}"
1165
      font-size="{$taxon-name-size-font}">
1166
      <fo:block text-align="justify" text-indent="-{$taxon-name-indentation}"
1167
        start-indent="{$taxon-name-indentation}">
1168
        <xsl:apply-templates select="../name"/>
1169
        <!--xsl:call-template name="citations"/-->
1170
        <!-- 99b2842f-9aa7-42fa-bd5f-7285311e0101 is Citation -->
1171
        <xsl:call-template name="citations">
1172
          <xsl:with-param name="descriptionelements"
1173
            select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements"/>
1174
          <xsl:with-param name="name-uuid" select="../name/uuid"/>
1175
        </xsl:call-template>
1176
        <!--xsl:text>.**********</xsl:text-->
1177
        <xsl:apply-templates select="homotypicSynonymsByHomotypicGroup"/>
1178
        <xsl:apply-templates select="../name/typeDesignations"/>
1179
      </fo:block>
1180
      <xsl:apply-templates select="heterotypicSynonymyGroups"/>
1181
    </fo:block>
1182
  </xsl:template>
1183

    
1184
  <xsl:template match="homotypicSynonymsByHomotypicGroup">
1185
    <xsl:for-each select="e">
1186
      <xsl:text> - </xsl:text>
1187
      <xsl:apply-templates select="name"/>
1188
      <xsl:call-template name="citations">
1189
        <!--LORNA Pass the description elements for the citation 99b2842f-9aa7-42fa-bd5f-7285311e0101 -->
1190
        <xsl:with-param name="descriptionelements"
1191
          select="../../../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements"/>
1192
        <xsl:with-param name="name-uuid" select="name/uuid"/>
1193
      </xsl:call-template>
1194
    </xsl:for-each>
1195

    
1196
    <!--xsl:apply-templates select="e[1]/name[1]/homotypicalGroup[1]/typifiedNames[1]/e/taxonBases[1]/e/descriptions[1]/e/elements[1]/e[1]/media[1]/e/representations[1]/e/parts[1]/e/uri"></xsl:apply-templates-->
1197
  </xsl:template>
1198

    
1199
  <xsl:template match="heterotypicSynonymyGroups">
1200
    <xsl:for-each select="e">
1201
      <fo:block text-align="start" text-indent="-{$taxon-name-indentation}"
1202
        start-indent="{$taxon-name-indentation}">
1203
        <xsl:for-each select="e">
1204
          <xsl:apply-templates select="name"/>
1205
          <xsl:call-template name="citations">
1206
            <xsl:with-param name="descriptionelements"
1207
              select="../../../../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements"/>
1208
            <xsl:with-param name="name-uuid" select="name/uuid"/>
1209
            
1210
          </xsl:call-template>
1211
          <xsl:apply-templates select="name/typeDesignations"/>
1212
        </xsl:for-each>
1213
        <!--xsl:apply-templates select="e[1]/name/typeDesignations" /-->
1214
      </fo:block>
1215
    </xsl:for-each>
1216
    
1217
  </xsl:template>   
1218

    
1219
  <xsl:template name="citations">
1220
    <xsl:param name="name-uuid"/>
1221
    <xsl:param name="descriptionelements"/>
1222
    <!--xsl:for-each
1223
      select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements/descriptionelement"-->
1224
    <xsl:for-each select="$descriptionelements/descriptionelement">
1225
      <!-- TODO sorting only works for the first citation, implement correctly -->
1226
      <xsl:sort select="sources/e[1]/citation/datePublished/start"/>
1227
      <xsl:for-each select="sources/e">
1228
        
1229
        <xsl:variable name="lastname_text" select="citation/authorTeam/lastname"/>
1230
        <xsl:variable name="prev_lastname_text" select="preceding-sibling::e[1]/citation/authorTeam/lastname"/>
1231
        
1232
        <xsl:if test="nameUsedInSource/uuid=$name-uuid">
1233
          <xsl:text>; </xsl:text>
1234
          <fo:inline>
1235
            <!--xsl:value-of select="citation/authorTeam/titleCache"/-->
1236
            <!--TODO wrap this in a variable and compare the previous variable to this one to see if we're dealing with the same name-->
1237
            <xsl:for-each select="citation/authorTeam/teamMembers/e">
1238
              <xsl:value-of select="lastname"/>
1239
              <xsl:choose>
1240
                <xsl:when test="position() != last()">
1241
                  <xsl:text> &amp; </xsl:text>
1242
                </xsl:when>
1243
              </xsl:choose>
1244
            </xsl:for-each>
1245

    
1246
<xsl:choose>
1247
            <xsl:when test="$lastname_text != $prev_lastname_text">
1248
            <xsl:value-of select="citation/authorTeam/lastname"/><!--TODO We print lastname here as well as the author list is this a mistake?-->
1249
            
1250
            <xsl:text> (</xsl:text>
1251
            <xsl:value-of select="citation/datePublished/start"/>
1252
              <xsl:if test="citationMicroReference != ''">
1253
            <xsl:text>: </xsl:text>
1254
            <xsl:value-of select="citationMicroReference"/>
1255
              </xsl:if>
1256
            <xsl:text>)</xsl:text>
1257
            </xsl:when>
1258
  <xsl:otherwise>
1259
    <xsl:text> </xsl:text><!-- TODO For the first ref with a particlar name we should open brackets -->
1260
    <xsl:value-of select="citation/datePublished/start"/>
1261
    <xsl:if test="citationMicroReference != ''">
1262
      <xsl:text>: </xsl:text>
1263
      <xsl:value-of select="citationMicroReference"/>
1264
    </xsl:if>
1265
  </xsl:otherwise>
1266
</xsl:choose>
1267
          </fo:inline>
1268
        </xsl:if>
1269
      </xsl:for-each>
1270
    </xsl:for-each>
1271
  </xsl:template>
1272
  
1273
  <xsl:template name="citationsworks">
1274
    <xsl:param name="name-uuid"/>
1275
    <xsl:param name="descriptionelements"/>
1276
    <!--xsl:for-each
1277
      select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements/descriptionelement"-->
1278
    <xsl:for-each select="$descriptionelements/descriptionelement">
1279
      <!-- TODO sorting only works for the first citation, implement correctly -->
1280
      <xsl:sort select="sources/e[1]/citation/datePublished/start"/>
1281
      <xsl:for-each select="sources/e">
1282
        
1283
        <xsl:if test="nameUsedInSource/uuid=$name-uuid">
1284
          <xsl:text>; </xsl:text>
1285
          <fo:inline>
1286
            <!--xsl:value-of select="citation/authorTeam/titleCache"/-->
1287
            <xsl:for-each select="citation/authorTeam/teamMembers/e">
1288
              <xsl:value-of select="lastname"/>
1289
              <xsl:choose>
1290
                <xsl:when test="position() != last()">
1291
                  <xsl:text> &amp; </xsl:text>
1292
                </xsl:when>
1293
              </xsl:choose>
1294
            </xsl:for-each>
1295
            
1296
            <xsl:value-of select="citation/authorTeam/lastname"/>
1297
            <xsl:text> (</xsl:text>
1298
            <xsl:value-of select="citation/datePublished/start"/>
1299
            <xsl:text>: </xsl:text>
1300
            <xsl:value-of select="citationMicroReference"/>
1301
            <xsl:text>)</xsl:text>
1302
          </fo:inline>
1303
        </xsl:if>
1304
      </xsl:for-each>
1305
    </xsl:for-each>
1306
  </xsl:template>
1307

    
1308
  
1309
  <!-- this template is for the list of all citations at the end of the PDF -->
1310
  <!-- references are under //citation and under //nomenclaturalReference and //inReference-->
1311
  <!-- could try //class[.='Reference']/parent::node() to get all References -->
1312
  <xsl:key name="citations-by-uuid" match="//citation | //nomenclaturalReference" use="uuid" />
1313
  <!--xsl:key name="nomenclaturalrefs-by-uuid" match="//nomenclaturalReference" use="uuid" /-->
1314

    
1315
  <xsl:template name="References"> 
1316
    <!-- new line for the end of the section -->
1317
    <xsl:text>&#xA;</xsl:text>
1318
        
1319
    <!--nomenclaturalReference or citation-->
1320
    <!-- problem with this is that if the same reference occurs under citaiton and under nomenclaturalReference it appears twice -->
1321
    <!--//nomenclaturalReference xsl:for-each select="//nomenclaturalReference[count(. | key('nomenclaturalrefs-by-uuid', uuid)[1]) = 1] | //citation[count(. | key('citations-by-uuid', uuid)[1]) = 1]"-->
1322
    
1323
    <!--xsl:for-each select="//nomenclaturalReference | //citation"-->
1324
    <xsl:for-each select="//nomenclaturalReference[count(. | key('citations-by-uuid', uuid)[1]) = 1] | //citation[count(. | key('citations-by-uuid', uuid)[1]) = 1]">
1325
    <!--xsl:for-each select="//nomenclaturalReference[count(. | key('nomenclaturalrefs-by-uuid', uuid)[1]) = 1]"-->
1326
      <!--xsl:for-each select="//nomenclaturalReference"-->
1327
        <xsl:sort select="authorship/lastname | authorship/teamMembers/e[1]/lastname" />
1328
      <xsl:sort select="datePublished/start"></xsl:sort>
1329

    
1330
      <fo:block linefeed-treatment="preserve" text-align="justify" text-indent="-{$taxon-name-indentation}" start-indent="{$taxon-name-indentation}">
1331
        
1332
        <fo:inline>        
1333
          <!-- filter out repeated citation uuids. Could write a controller method in the CDM to get all unique references for a TaxonNode -->
1334
          <!--xsl:value-of select="uuid"/> FOR DEBUGGING-->
1335
          <!--xsl:value-of select="titleCache"/-->
1336
          
1337
          <!--I am only listing references which have at least one author name. If there are other references in the database - why don't these have an author name-->
1338
          <xsl:if test="authorship/teamMembers/e[1]/lastname != '' or authorship/lastname != '' or authorship/titleCache != ''">               
1339
                <!--xsl:text>&#xA;</xsl:text-->
1340
                <xsl:choose>
1341
                  <xsl:when test="authorship/teamMembers/e[1]/lastname != ''">
1342
                    <xsl:for-each select="authorship/teamMembers/e">
1343
                      <fo:inline>
1344
                        <xsl:value-of select="lastname"/>
1345
                        <xsl:text> </xsl:text>
1346
                        <xsl:value-of select="firstname"/>
1347
                        <xsl:choose>
1348
                          <xsl:when test="position() != last()">
1349
                            <xsl:text> &amp; </xsl:text>
1350
                          </xsl:when>
1351
                        </xsl:choose>
1352
                      </fo:inline>
1353
                    </xsl:for-each>
1354
                  </xsl:when>
1355
                  <xsl:otherwise>
1356
                    <xsl:choose>
1357
                      <xsl:when test="authorship/lastname != ''">
1358
                    <!--xsl:if test="authorship/lastname != ''"-->
1359
                    <fo:inline>
1360
                      <xsl:value-of select="authorship/lastname"/>
1361
                      <xsl:text> </xsl:text>
1362
                      <xsl:value-of select="authorship/firstname"/>
1363
                    </fo:inline>
1364
                      </xsl:when>
1365
                      <xsl:otherwise>
1366
                        <fo:inline>
1367
                          <xsl:value-of select="authorship/titleCache"/>
1368
                        </fo:inline>
1369
                      </xsl:otherwise>
1370
                    <!--/xsl:if-->
1371
                    </xsl:choose>
1372
                    
1373
                  </xsl:otherwise>
1374
                </xsl:choose>                            
1375
                
1376
                <xsl:if test="datePublished/start != ''">
1377
                  <xsl:text> (</xsl:text>
1378
                  <xsl:value-of select="datePublished/start"/>
1379
                  <xsl:text>) </xsl:text>
1380
                </xsl:if>                
1381
                
1382
                <xsl:apply-templates select="title"/>
1383
                <xsl:apply-templates select="volume"/>
1384
                <xsl:apply-templates select="pages"/>
1385
                <xsl:apply-templates select="placePublished"/>
1386
                <xsl:apply-templates select="publisher"/>
1387
                
1388
                <!-- if inReference has child nodes-->
1389
                <xsl:if test="count(inReference/*) &gt; 0">
1390
                  
1391
                  <xsl:text>In </xsl:text>
1392
                  <xsl:apply-templates select="inReference/title"/>
1393
                  <xsl:apply-templates select="inReference/volume"/>
1394
                  <xsl:apply-templates select="inReference/pages"/>
1395
                  <xsl:apply-templates select="inReference/placePublished"/>
1396
                  <xsl:apply-templates select="inReference/publisher"/>
1397
                </xsl:if>
1398
                <!--add template match to self:: that works for the above whether it's a citation or nomenclaturalReference -->              
1399
                <!-- new line for the end of the section -->
1400
                <xsl:text>&#xA;</xsl:text>             
1401
              </xsl:if>                  
1402
        </fo:inline>      
1403
      </fo:block>     
1404
    </xsl:for-each>
1405
  </xsl:template>
1406
  
1407
  <xsl:template match="*">
1408

    
1409
    <xsl:choose>
1410
      <xsl:when test="name(.) = 'pages'">
1411
        <xsl:value-of select="replace(.,'&hyphen;','&ndash;')" />
1412
      </xsl:when>
1413
      <xsl:otherwise>
1414
        <xsl:value-of select="." />
1415
      </xsl:otherwise>
1416
    </xsl:choose>
1417
      
1418
    <xsl:if test="name(.) = 'title' or name(.) = 'publisher' or name(.) = 'pages'">
1419
      <!-- . if pages or publisher or title - comma if placePublished -->
1420
      <xsl:text>. </xsl:text> 
1421
    </xsl:if>
1422
    
1423
    <xsl:if test="name(.) = 'volume'">
1424
      <xsl:text>: </xsl:text>
1425
    </xsl:if>
1426
    
1427
    <xsl:if test="(../type = 'Book' or ../type = 'BookSection') and name(.) = 'placePublished' and . != ''">
1428
      <xsl:text>, </xsl:text> 
1429
    </xsl:if>
1430
   
1431

    
1432
  </xsl:template>
1433
  
1434

    
1435
  <xsl:template name="Referencesold">
1436
    
1437
      <!-- need to sort by lastname of the first author i.e. //citation/authorTeam/teamMembers/e[1]/lastname -->
1438
      <xsl:for-each select="//citation">
1439

    
1440
        <!-- TODO sorting only works for the first citation, implement correctly -->
1441
        <xsl:sort select="authorship/lastname"/>
1442
        <xsl:sort select="authorship/teamMembers/e[1]/lastname"/>
1443
        <fo:block>
1444
        <fo:inline>
1445
          
1446
          <!-- filter out repeated citation uuids. Could write a controller method in the CDM to get all unique references for a TaxonNode -->
1447
          <xsl:variable name="prev_citation_uuid" select="preceding-sibling::citation/uuid"/>
1448
          <xsl:variable name="citation_uuid" select="uuid"/>
1449
          <xsl:text>preceeding:</xsl:text>
1450
          <xsl:value-of select="preceding-sibling::citation[1]/uuid"></xsl:value-of>
1451
          <xsl:text>current:</xsl:text>
1452
          <xsl:value-of select="uuid"></xsl:value-of>
1453

    
1454
          <!--xsl:value-of select="preceding-sibling::citation/uuid"></xsl:value-of-->
1455

    
1456
          <!--xsl:if test="$citation_uuid != $prev_citation_uuid"-->
1457
          <xsl:if test="preceding-sibling::citation[1]/uuid  != uuid">   
1458
            
1459
           <!-- .[not(preceding-sibling::Link[@personId   = current()/@personId -->
1460
          <xsl:choose>
1461
                         
1462
            <xsl:when test="authorship/teamMembers/e[1]/lastname != '' or authorship/lastname != ''">                                     
1463
            
1464
              <xsl:choose>
1465
                <xsl:when test="authorship/teamMembers/e[1]/lastname != ''">
1466
                <xsl:for-each select="authorship/teamMembers/e">
1467
                  <fo:inline font-weight="bold">
1468
                    <xsl:value-of select="lastname"/>
1469
                    <xsl:choose>
1470
                      <xsl:when test="position() != last()">
1471
                        <xsl:text> &amp; </xsl:text>
1472
                      </xsl:when>
1473
                    </xsl:choose>
1474
                  </fo:inline>
1475
                </xsl:for-each>
1476
                </xsl:when>
1477
                <xsl:otherwise>
1478
                  <xsl:if test="authorship/lastname != ''">
1479
                  <fo:inline font-weight="bold">
1480
                    <xsl:value-of select="authorship/lastname"/>
1481
                  </fo:inline>
1482
                  </xsl:if>
1483
                </xsl:otherwise>
1484
                
1485
              </xsl:choose>                            
1486
              
1487
              <xsl:if test="datePublished/start != ''">
1488
                <xsl:text> (</xsl:text>
1489
                <xsl:value-of select="datePublished/start"/>
1490
                <xsl:text>) </xsl:text>
1491
              </xsl:if>
1492
              <xsl:value-of select="title"/>
1493
              <xsl:text>.</xsl:text>
1494
              <xsl:value-of select="pages"/>
1495
              <xsl:text>.</xsl:text>
1496
              
1497
              <!-- new line for the end of the section -->
1498
              <xsl:text>&#xA;</xsl:text>
1499
              
1500
            </xsl:when>
1501
            <!--xsl:otherwise>
1502
              <xsl:text>HELLO&#xA;</xsl:text>
1503
            </xsl:otherwise-->
1504
          </xsl:choose>
1505
          </xsl:if>
1506
          
1507
        </fo:inline>
1508

    
1509
    </fo:block>
1510
    <xsl:text>&#xA;</xsl:text>
1511
      </xsl:for-each>
1512
      
1513

    
1514

    
1515

    
1516
  </xsl:template>
1517

    
1518
  <xsl:template match="typeDesignations">
1519
    <xsl:for-each select="child::*">
1520
      <fo:inline>
1521
        <xsl:text> - Type: </xsl:text>
1522
        <xsl:choose>
1523
          <xsl:when test="class='SpecimenTypeDesignation'">
1524
            <xsl:value-of select="typeSpecimen/titleCache"/>
1525
          </xsl:when>
1526
        </xsl:choose>
1527
      </fo:inline>
1528
    </xsl:for-each>
1529
  </xsl:template>
1530

    
1531

    
1532
</xsl:stylesheet>
(4-4/4)