Project

General

Profile

« Previous | Next » 

Revision 462bffb1

Added by Niels Hoffmann over 12 years ago

Adresse some issues with the flora malesiana stylesheet

View differences:

cdmlib-print/src/main/resources/stylesheets/pdf/flora-malesiana.xsl
1 1
<?xml version="1.0" encoding="UTF-8"?>
2

  
3 2
<!--
4 3
  
5 4
  CDM XSL Transformation
6 5
  Target Format: Flora Malesiana
7 6
  
8 7
  -->
9
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10
  xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
11

  
12
  <!-- ############### Constants and definitions ################### -->
13

  
14
  <!-- **********************************
8
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1" exclude-result-prefixes="fo">
9
	<!-- ############### Constants and definitions ################### -->
10
	<!-- **********************************
15 11
    ** global definitions 
16 12
    *********************************** -->
17
  <xsl:param name="global-family-font">Times</xsl:param>
18
  <xsl:param name="global-size-font">12pt</xsl:param>
19
  <xsl:param name="global-line-height">1.2em</xsl:param>
20

  
21
  <xsl:param name="global-height-page">297mm</xsl:param>
22
  <xsl:param name="global-width-page">210mm</xsl:param>
23

  
24
  <xsl:param name="global-indentation">8mm</xsl:param>
25

  
26
  <!-- **********************************   
13
	<xsl:param name="global-family-font">Times</xsl:param>
14
	<xsl:param name="global-size-font">12pt</xsl:param>
15
	<xsl:param name="global-line-height">1.2em</xsl:param>
16
	<xsl:param name="global-height-page">297mm</xsl:param>
17
	<xsl:param name="global-width-page">210mm</xsl:param>
18
	<xsl:param name="global-indentation">8mm</xsl:param>
19
	<!-- **********************************   
27 20
    ** definitions for taxon pages
28 21
    *********************************** -->
29
  <xsl:param name="taxon-page-top-margin">0mm</xsl:param>
30
  <xsl:param name="taxon-page-right-margin">32mm</xsl:param>
31
  <xsl:param name="taxon-page-bottom-margin">0mm</xsl:param>
32
  <xsl:param name="taxon-page-left-margin">32mm</xsl:param>
33

  
34
  <xsl:param name="taxon-region-body-top-margin">26mm</xsl:param>
35
  <xsl:param name="taxon-region-body-bottom-margin">28mm</xsl:param>
36

  
37
  <xsl:param name="taxon-region-before-extent">0mm</xsl:param>
38
  <xsl:param name="taxon-region-after-extent">0mm</xsl:param>
39

  
40
  <xsl:param name="taxon-header-family-font">Times</xsl:param>
41
  <xsl:param name="taxon-header-before-bg-color">white</xsl:param>
42
  <xsl:param name="content-bg-color">white</xsl:param>
43
  <xsl:param name="taxon-header-after-bg-color">white</xsl:param>
44
  <xsl:param name="taxon-header-size-font">9pt</xsl:param>
45
  <xsl:param name="taxon-header-style-font">italic</xsl:param>
46
  <xsl:param name="taxon-header-page-number-size-font">8pt</xsl:param>
47
  <xsl:param name="taxon-header-page-number-align-text">end</xsl:param>
48

  
49
  <xsl:param name="taxon-page-number-initial">1</xsl:param>
50

  
51
  <xsl:param name="uuidFamily">210a8214-4e69-401a-8e47-c7940d990bdd</xsl:param>
52
  <xsl:param name="uuidGenus">1b11c34c-48a8-4efa-98d5-84f7f66ef43a</xsl:param>
53
  <xsl:param name="uuidSubgenus">78786e16-2a70-48af-a608-494023b91904</xsl:param>
54

  
55
  <!-- **********************************   
22
	<xsl:param name="taxon-page-top-margin">0mm</xsl:param>
23
	<xsl:param name="taxon-page-right-margin">32mm</xsl:param>
24
	<xsl:param name="taxon-page-bottom-margin">0mm</xsl:param>
25
	<xsl:param name="taxon-page-left-margin">32mm</xsl:param>
26
	<xsl:param name="taxon-region-body-top-margin">26mm</xsl:param>
27
	<xsl:param name="taxon-region-body-bottom-margin">28mm</xsl:param>
28
	<xsl:param name="taxon-region-before-extent">0mm</xsl:param>
29
	<xsl:param name="taxon-region-after-extent">0mm</xsl:param>
30
	<xsl:param name="taxon-header-family-font">Times</xsl:param>
31
	<xsl:param name="taxon-header-before-bg-color">white</xsl:param>
32
	<xsl:param name="content-bg-color">white</xsl:param>
33
	<xsl:param name="taxon-header-after-bg-color">white</xsl:param>
34
	<xsl:param name="taxon-header-size-font">9pt</xsl:param>
35
	<xsl:param name="taxon-header-style-font">italic</xsl:param>
36
	<xsl:param name="taxon-header-page-number-size-font">8pt</xsl:param>
37
	<xsl:param name="taxon-header-page-number-align-text">end</xsl:param>
38
	<xsl:param name="taxon-page-number-initial">1</xsl:param>
39
	<xsl:param name="uuidFamily">210a8214-4e69-401a-8e47-c7940d990bdd</xsl:param>
40
	<xsl:param name="uuidGenus">1b11c34c-48a8-4efa-98d5-84f7f66ef43a</xsl:param>
41
	<xsl:param name="uuidSubgenus">78786e16-2a70-48af-a608-494023b91904</xsl:param>
42
	<!-- **********************************   
56 43
    ** html support
57 44
    *********************************** -->
58

  
59
  <!-- format html i tags in text as italic -->
60
  <xsl:template match="i">
61
    <fo:inline font-style="italic">
62
      <xsl:value-of select="."/>
63
    </fo:inline>
64
  </xsl:template>
65

  
66
  <!-- format html b tags in text as bold -->
67
  <xsl:template match="b">
68
    <fo:inline font-weight="bold">
69
      <xsl:apply-templates/>
70
    </fo:inline>
71
  </xsl:template>
72

  
73
  <!-- ########################################################################## -->
74

  
75

  
76
  <!-- start xsl output -->
77
  <xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="no"/>
78
  <xsl:param name="versionParam" select="'1.0'"/>
79

  
80
  <!-- root element: root -->
81
  <xsl:template match="root">
82
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
83

  
84
      <!-- defines page layout -->
85
      <fo:layout-master-set>
86

  
87
        <!-- layout for odd taxon pages -->
88
        <fo:simple-page-master master-name="taxon_page_odd" page-height="{$global-height-page}"
89
          page-width="{$global-width-page}" margin-top="{$taxon-page-top-margin}"
90
          margin-bottom="{$taxon-page-bottom-margin}" margin-left="{$taxon-page-left-margin}"
91
          margin-right="{$taxon-page-right-margin}">
92
          <fo:region-body margin-top="{$taxon-region-body-top-margin}"
93
            margin-bottom="{$taxon-region-body-bottom-margin}"/>
94
          <fo:region-before extent="{$taxon-region-before-extent}" region-name="odd-before"/>
95
          <fo:region-after extent="{$taxon-region-after-extent}" region-name="odd-after"/>
96
        </fo:simple-page-master>
97

  
98
        <!-- layout for even taxon pages -->
99
        <fo:simple-page-master master-name="taxon_page_even" page-height="{$global-height-page}"
100
          page-width="{$global-width-page}" margin-top="{$taxon-page-top-margin}"
101
          margin-bottom="{$taxon-page-bottom-margin}" margin-left="{$taxon-page-left-margin}"
102
          margin-right="{$taxon-page-right-margin}">
103
          <fo:region-body margin-top="{$taxon-region-body-top-margin}"
104
            margin-bottom="{$taxon-region-body-bottom-margin}"/>
105
          <fo:region-before extent="{$taxon-region-before-extent}" region-name="even-before"/>
106
          <fo:region-after extent="{$taxon-region-after-extent}" region-name="even-after"/>
107
        </fo:simple-page-master>
108

  
109

  
110

  
111
        <!-- defines repeatable page-sequence for layout of taxa -->
112
        <fo:page-sequence-master master-name="taxon_page">
113
          <fo:repeatable-page-master-alternatives>
114
            <fo:conditional-page-master-reference master-reference="taxon_page_odd"
115
              page-position="first"/>
116
            <fo:conditional-page-master-reference master-reference="taxon_page_odd"
117
              page-position="rest" odd-or-even="even"/>
118
            <fo:conditional-page-master-reference master-reference="taxon_page_even"
119
              page-position="rest" odd-or-even="odd"/>
120
            <!--            <fo:conditional-page-master-reference master-reference="mclBoook_taxon_page_even"
45
	<!-- format html i tags in text as italic -->
46
	<xsl:template match="i">
47
		<fo:inline font-style="italic">
48
			<xsl:value-of select="."/>
49
		</fo:inline>
50
	</xsl:template>
51
	<!-- format html b tags in text as bold -->
52
	<xsl:template match="b">
53
		<fo:inline font-weight="bold">
54
			<xsl:apply-templates/>
55
		</fo:inline>
56
	</xsl:template>
57
	<!-- ########################################################################## -->
58
	<!-- start xsl output -->
59
	<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="no"/>
60
	<xsl:param name="versionParam" select="'1.0'"/>
61
	<!-- root element: root -->
62
	<xsl:template match="root">
63
		<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
64
			<!-- defines page layout -->
65
			<fo:layout-master-set>
66
				<!-- layout for odd taxon pages -->
67
				<fo:simple-page-master master-name="taxon_page_odd" page-height="{$global-height-page}" page-width="{$global-width-page}" margin-top="{$taxon-page-top-margin}" margin-bottom="{$taxon-page-bottom-margin}" margin-left="{$taxon-page-left-margin}" margin-right="{$taxon-page-right-margin}">
68
					<fo:region-body margin-top="{$taxon-region-body-top-margin}" margin-bottom="{$taxon-region-body-bottom-margin}"/>
69
					<fo:region-before extent="{$taxon-region-before-extent}" region-name="odd-before"/>
70
					<fo:region-after extent="{$taxon-region-after-extent}" region-name="odd-after"/>
71
				</fo:simple-page-master>
72
				<!-- layout for even taxon pages -->
73
				<fo:simple-page-master master-name="taxon_page_even" page-height="{$global-height-page}" page-width="{$global-width-page}" margin-top="{$taxon-page-top-margin}" margin-bottom="{$taxon-page-bottom-margin}" margin-left="{$taxon-page-left-margin}" margin-right="{$taxon-page-right-margin}">
74
					<fo:region-body margin-top="{$taxon-region-body-top-margin}" margin-bottom="{$taxon-region-body-bottom-margin}"/>
75
					<fo:region-before extent="{$taxon-region-before-extent}" region-name="even-before"/>
76
					<fo:region-after extent="{$taxon-region-after-extent}" region-name="even-after"/>
77
				</fo:simple-page-master>
78
				<!-- defines repeatable page-sequence for layout of taxa -->
79
				<fo:page-sequence-master master-name="taxon_page">
80
					<fo:repeatable-page-master-alternatives>
81
						<fo:conditional-page-master-reference master-reference="taxon_page_odd" page-position="first"/>
82
						<fo:conditional-page-master-reference master-reference="taxon_page_odd" page-position="rest" odd-or-even="even"/>
83
						<fo:conditional-page-master-reference master-reference="taxon_page_even" page-position="rest" odd-or-even="odd"/>
84
						<!--            <fo:conditional-page-master-reference master-reference="mclBoook_taxon_page_even"
121 85
              page-position="last"/>-->
122
          </fo:repeatable-page-master-alternatives>
123
        </fo:page-sequence-master>
124
      </fo:layout-master-set>
125
      <!-- end: defines page layout -->
126

  
127
      <!-- page sequence for taxon view -->
128
      <fo:page-sequence master-reference="taxon_page"
129
        initial-page-number="{$taxon-page-number-initial}" force-page-count="no-force">
130

  
131
        <fo:static-content flow-name="odd-before">
132
          <xsl:call-template name="odd-before-header"/>
133
        </fo:static-content>
134

  
135
        <fo:static-content flow-name="even-before">
136
          <xsl:call-template name="even-before-header"/>
137
        </fo:static-content>
138

  
139
        <fo:static-content flow-name="odd-after">
140
          <xsl:call-template name="odd-after-header"/>
141
        </fo:static-content>
142

  
143
        <fo:static-content flow-name="even-after">
144
          <xsl:call-template name="even-after-header"/>
145
        </fo:static-content>
146

  
147
        <!-- format taxa -->
148
        <fo:flow flow-name="xsl-region-body">
149
          <fo:block font-family="{$global-family-font}" font-size="{$global-size-font}"
150
            line-height="{$global-line-height}">
151
            <xsl:for-each select="//TaxonNode">
152
              <xsl:apply-templates select="."/>
153
            </xsl:for-each>
154
          </fo:block>
155
        </fo:flow>
156

  
157
      </fo:page-sequence>
158
    </fo:root>
159
  </xsl:template>
160

  
161
  <!-- HEADER -->
162

  
163
  <xsl:template name="odd-before-header">
164

  
165
    <fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}"
166
      font-size="{$taxon-header-size-font}">
167
      <!-- No pagination at the moment
86
					</fo:repeatable-page-master-alternatives>
87
				</fo:page-sequence-master>
88
			</fo:layout-master-set>
89
			<!-- end: defines page layout -->
90
			<!-- page sequence for taxon view -->
91
			<fo:page-sequence master-reference="taxon_page" initial-page-number="{$taxon-page-number-initial}" force-page-count="no-force">
92
				<fo:static-content flow-name="odd-before">
93
					<xsl:call-template name="odd-before-header"/>
94
				</fo:static-content>
95
				<fo:static-content flow-name="even-before">
96
					<xsl:call-template name="even-before-header"/>
97
				</fo:static-content>
98
				<fo:static-content flow-name="odd-after">
99
					<xsl:call-template name="odd-after-header"/>
100
				</fo:static-content>
101
				<fo:static-content flow-name="even-after">
102
					<xsl:call-template name="even-after-header"/>
103
				</fo:static-content>
104
				<!-- format taxa -->
105
				<fo:flow flow-name="xsl-region-body">
106
					<fo:block font-family="{$global-family-font}" font-size="{$global-size-font}" line-height="{$global-line-height}">
107
						<xsl:for-each select="//TaxonNode">
108
							<xsl:apply-templates select="."/>
109
						</xsl:for-each>
110
					</fo:block>
111
				</fo:flow>
112
			</fo:page-sequence>
113
		</fo:root>
114
	</xsl:template>
115
	<!-- HEADER -->
116
	<xsl:template name="odd-before-header">
117
		<fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}" font-size="{$taxon-header-size-font}">
118
			<!-- No pagination at the moment
168 119
      <fo:block font-size="{$taxon-header-page-number-size-font}"
169 120
        text-align="{$taxon-header-page-number-align-text}"> &#x2014; <fo:page-number/> &#x2014; </fo:block>
170 121
        <fo:block color="white">-</fo:block> -->
171
      <fo:block>
172
        <fo:retrieve-marker retrieve-class-name="pageTitleMarker"
173
          retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
174
        <xsl:text> </xsl:text>
175
        <fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker"
176
          retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
177
      </fo:block>
178
    </fo:block>
179

  
180
  </xsl:template>
181

  
182
  <xsl:template name="odd-before-header-endnote">
183
    <fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}"
184
      font-size="{$taxon-header-size-font}">
185
      <!-- No pagination at the moment
122
			<fo:block>
123
				<fo:retrieve-marker retrieve-class-name="pageTitleMarker" retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
124
				<xsl:text> </xsl:text>
125
				<fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker" retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
126
			</fo:block>
127
		</fo:block>
128
	</xsl:template>
129
	<xsl:template name="odd-before-header-endnote">
130
		<fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}" font-size="{$taxon-header-size-font}">
131
			<!-- No pagination at the moment
186 132
      <fo:block font-size="{$taxon-header-page-number-size-font}"
187 133
        text-align="{$taxon-header-page-number-align-text}"> &#x2014; <fo:page-number/> &#x2014;
188 134
        </fo:block> -->
189
    </fo:block>
190
  </xsl:template>
191

  
192
  <xsl:template name="odd-after-header">
193
    <fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}"
194
      font-size="{$taxon-header-size-font}">
195
      <fo:block>
196
        <fo:inline>
197
          <fo:retrieve-marker retrieve-class-name="pageTitleMarker"
198
            retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
199
          <fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker"
200
            retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
201
        </fo:inline>
202
      </fo:block>
203
    </fo:block>
204
  </xsl:template>
205

  
206

  
207
  <xsl:template name="even-before-header">
208
    <fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}"
209
      font-size="{$taxon-header-size-font}">
210
      <!--
135
		</fo:block>
136
	</xsl:template>
137
	<xsl:template name="odd-after-header">
138
		<fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}" font-size="{$taxon-header-size-font}">
139
			<fo:block>
140
				<fo:inline>
141
					<fo:retrieve-marker retrieve-class-name="pageTitleMarker" retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
142
					<fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker" retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
143
				</fo:inline>
144
			</fo:block>
145
		</fo:block>
146
	</xsl:template>
147
	<xsl:template name="even-before-header">
148
		<fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}" font-size="{$taxon-header-size-font}">
149
			<!--
211 150
      No pagination at the moment  
212 151
      <fo:block color="white" font-size="{$taxon-header-page-number-size-font}">-</fo:block>
213 152
      <fo:block color="white">-</fo:block>-->
214
      <fo:block>
215
        <fo:inline>
216
          <fo:retrieve-marker retrieve-class-name="pageTitleMarker"
217
            retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
218
          <fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker"
219
            retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
220
        </fo:inline>
221
      </fo:block>
222
    </fo:block>
223

  
224
  </xsl:template>
225

  
226
  <xsl:template name="even-after-header">
227
    <fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}"
228
      font-size="{$taxon-header-size-font}">
229
      <fo:block>
230
        <fo:inline>
231
          <fo:retrieve-marker retrieve-class-name="pageTitleMarker"
232
            retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
233
          <fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker"
234
            retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
235
        </fo:inline>
236
      </fo:block>
237
      <!-- No pagination at the moment
153
			<fo:block>
154
				<fo:inline>
155
					<fo:retrieve-marker retrieve-class-name="pageTitleMarker" retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
156
					<fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker" retrieve-position="first-starting-within-page" retrieve-boundary="document"/>
157
				</fo:inline>
158
			</fo:block>
159
		</fo:block>
160
	</xsl:template>
161
	<xsl:template name="even-after-header">
162
		<fo:block font-family="{$taxon-header-family-font}" font-style="{$taxon-header-style-font}" font-size="{$taxon-header-size-font}">
163
			<fo:block>
164
				<fo:inline>
165
					<fo:retrieve-marker retrieve-class-name="pageTitleMarker" retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
166
					<fo:retrieve-marker retrieve-class-name="pageTitleSectionMarker" retrieve-position="last-starting-within-page" retrieve-boundary="document"/>
167
				</fo:inline>
168
			</fo:block>
169
			<!-- No pagination at the moment
238 170
      <fo:block color="white">-</fo:block>
239 171
      <fo:block font-size="{$taxon-header-page-number-size-font}"
240 172
        text-align="{$taxon-header-page-number-align-text}"> &#x2014; <fo:page-number/> &#x2014;
241 173
        </fo:block> -->
242
    </fo:block>
243
  </xsl:template>
244

  
245
  <!-- GENERAL -->
246

  
247
  <xsl:template match="TaxonNode" name="TaxonNode">
248
    <xsl:apply-templates select="Taxon"/>
249
  </xsl:template>
250

  
251
  <xsl:template match="Taxon" name="Taxon">
252
    <xsl:call-template name="title"/>
253
    <xsl:apply-templates select="synonymy"/>
254
    <xsl:apply-templates select="descriptions"/>
255
  </xsl:template>
256

  
257

  
258
  <xsl:template name="title">
259
    <fo:block margin-bottom="5mm">
260
      <!-- we need to find a way to store the uuid in a variable xsl:parameter did not work or i was using it wrong -->
261
      <xsl:choose>
262
        <!-- family -->
263
        <xsl:when test="name/rank/uuid='af5f2481-3192-403f-ae65-7c957a0f02b6'">
264
          <fo:block text-align="center" text-transform="uppercase">
265
            <xsl:apply-templates select="name/genusOrUninomial"/>
266
          </fo:block>
267
        </xsl:when>
268
        <!-- genus -->
269
        <xsl:when test="name/rank/uuid='1b11c34c-48a8-4efa-98d5-84f7f66ef43a'">
270
          <fo:block font-weight="bold" text-align="center" text-transform="uppercase">
271
            <xsl:apply-templates select="name/genusOrUninomial"/>
272
          </fo:block>
273
        </xsl:when>
274
        <!-- subgenus -->
275
        <xsl:when test="name/rank/uuid='78786e16-2a70-48af-a608-494023b91904'">
276
          <fo:block font-weight="bold" text-align="center">
277
            <xsl:apply-templates select="name/rank/representation_L10n"/>
278
            <xsl:text> </xsl:text>
279
            <xsl:apply-templates select="name/genusOrUninomial"/>
280
          </fo:block>
281
        </xsl:when>
282
        <!-- species -->
283
        <xsl:when test="name/rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d'"/>
284
        <xsl:otherwise>
285
          <!-- for debugging --> <!-- Unformatted title for rank uuid: <xsl:value-of
286
            select="name/rank/uuid"/>: <xsl:value-of select="name/titleCache"/>-->
287
        </xsl:otherwise>
288
      </xsl:choose>
289
    </fo:block>
290
  </xsl:template>
291

  
292
  <!-- NAME -->
293

  
294
  <xsl:template match="name">
295
    <xsl:apply-templates select="taggedName"/>
296
    <xsl:apply-templates select="nomenclaturalReference"/>
297
  </xsl:template>
298

  
299
  <xsl:template match="taggedName">
300
    <xsl:for-each select="e">
301
      <xsl:choose>
302
        <xsl:when test="type='name'">
303
          <xsl:choose>
304
            <xsl:when
305
              test="../../rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d' and name(../../..)='Taxon'">
306
              <fo:inline font-weight="bold">
307
                <xsl:value-of select="text"/>
308
              </fo:inline>
309
            </xsl:when>
310
            <xsl:otherwise>
311
              <fo:inline font-style="italic">
312
                <xsl:value-of select="text"/>
313
              </fo:inline>
314
            </xsl:otherwise>
315
          </xsl:choose>
316
          <xsl:text> </xsl:text>
317
        </xsl:when>
318
        <xsl:when test="type='authors'">
319
          <xsl:value-of select="text"/>
320
        </xsl:when>
321
        <xsl:otherwise>
322
          <xsl:value-of select="text"/>
323
          <xsl:text> </xsl:text>
324
        </xsl:otherwise>
325
      </xsl:choose>
326

  
327
    </xsl:for-each>
328
  </xsl:template>
329

  
330
  <xsl:template match="nomenclaturalReference">
331
    <fo:inline>
332
      <xsl:value-of
333
        select="substring-before(substring-after(titleCache, authorTeam/titleCache), datePublished/start)"/>
334
      <xsl:value-of select="concat('(', datePublished/start, ')')"/>
335
    </fo:inline>
336
    <xsl:text> </xsl:text>
337
    <fo:inline>
338
      <xsl:value-of select="../nomenclaturalMicroReference"/>
339
    </fo:inline>
340
  </xsl:template>
341

  
342
  <!-- DESCRIPTIONS -->
343

  
344
  <xsl:template match="descriptions" name="descriptions">
345
    <fo:block margin-bottom="5mm">
346
      <xsl:for-each select="features/feature">
347
        <fo:block text-indent="{$global-indentation}" text-align="justify">
348
          <xsl:choose>
349
            <xsl:when test="count(feature)!=0">
350
              <xsl:call-template name="secondLevelDescriptionElements"/>
351
            </xsl:when>
352
            <xsl:otherwise>
353
              <!-- everything except Citation -->
354
              <xsl:if test="uuid!='99b2842f-9aa7-42fa-bd5f-7285311e0101'">
355
                <xsl:value-of select="representation_L10n"/> - <xsl:call-template
356
                  name="descriptionElements"/>
174
		</fo:block>
175
	</xsl:template>
176
	<!-- GENERAL -->
177
	<xsl:template match="TaxonNode" name="TaxonNode">
178
		<xsl:apply-templates select="Taxon"/>
179
	</xsl:template>
180
	<xsl:template match="Taxon" name="Taxon">
181
		<xsl:call-template name="title"/>
182
		<xsl:apply-templates select="synonymy"/>
183
		<xsl:apply-templates select="descriptions"/>
184
	</xsl:template>
185
	<xsl:template name="title">
186
		<fo:block margin-bottom="5mm">
187
			<!-- we need to find a way to store the uuid in a variable xsl:parameter did not work or i was using it wrong -->
188
			<xsl:choose>
189
				<!-- family -->
190
				<xsl:when test="name/rank/uuid='af5f2481-3192-403f-ae65-7c957a0f02b6'">
191
					<fo:block text-align="center" text-transform="uppercase">
192
						<xsl:apply-templates select="name/genusOrUninomial"/>
193
					</fo:block>
194
				</xsl:when>
195
				<!-- genus -->
196
				<xsl:when test="name/rank/uuid='1b11c34c-48a8-4efa-98d5-84f7f66ef43a'">
197
					<fo:block font-weight="bold" text-align="center" text-transform="uppercase">
198
						<xsl:apply-templates select="name/genusOrUninomial"/>
199
					</fo:block>
200
				</xsl:when>
201
				<!-- subgenus -->
202
				<xsl:when test="name/rank/uuid='78786e16-2a70-48af-a608-494023b91904'">
203
					<fo:block font-weight="bold" text-align="center">
204
						<xsl:apply-templates select="name/rank/representation_L10n"/>
205
						<xsl:text> </xsl:text>
206
						<xsl:apply-templates select="name/genusOrUninomial"/>
207
					</fo:block>
208
				</xsl:when>
209
				<!-- species -->
210
				<xsl:when test="name/rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d'">
211
					<fo:block>
212
						<fo:inline font-weight="bold">
213
							<xsl:apply-templates select="name/genusOrUninomial"/>
214
							<xsl:text> </xsl:text>
215
							<xsl:apply-templates select="name/specificEpithet"/>
216
						</fo:inline>
217
						<xsl:text> </xsl:text>
218
						<xsl:call-template name="authorFromTaggedName"/>
219
					</fo:block>
220
				</xsl:when>
221
				<!-- infraspecific -->
222
				<xsl:otherwise>
223
					<fo:block>
224
						<xsl:apply-templates select="name/rank/abbreviation"/>
225
						<xsl:text> </xsl:text>
226
						<fo:inline font-weight="bold">
227
							<xsl:apply-templates select="name/infraSpecificEpithet"/>
228
						</fo:inline>
229
						<xsl:if test="name/specificEpithet != name/infraSpecificEpithet">
230
							<xsl:text> </xsl:text>
231
							<xsl:call-template name="authorFromTaggedName"/>
232
						</xsl:if>
233
					</fo:block>
234
				</xsl:otherwise>
235
			</xsl:choose>
236
		</fo:block>
237
	</xsl:template>
238
	<!-- NAME -->
239
	<xsl:template match="name">
240
		<xsl:apply-templates select="taggedName"/>
241
		<xsl:apply-templates select="nomenclaturalReference"/>
242
	</xsl:template>
243
	<xsl:template match="taggedName">
244
		<xsl:for-each select="e">
245
			<xsl:choose>
246
				<xsl:when test="type='name'">
247
					<fo:inline font-style="italic">
248
						<xsl:value-of select="text"/>
249
					</fo:inline>
250
					<xsl:text> </xsl:text>
251
				</xsl:when>
252
				<xsl:when test="type='authors'">
253
					<xsl:value-of select="text"/>
254
				</xsl:when>
255
				<xsl:otherwise>
256
					<xsl:value-of select="text"/>
257
				</xsl:otherwise>
258
			</xsl:choose>
259
			<xsl:if test="not(position() = last())">
260
				<xsl:text> </xsl:text>
261
			</xsl:if>
262
		</xsl:for-each>
263
	</xsl:template>
264
	<!-- AUTHOR -->
265
	<xsl:template name="authorFromTaggedName">
266
		<xsl:for-each select="name/taggedName/e">
267
			<xsl:choose>
268
				<xsl:when test="type='authors'">
269
					<xsl:value-of select="text"/>
270
				</xsl:when>
271
			</xsl:choose>
272
		</xsl:for-each>
273
	</xsl:template>
274
	
275
	<xsl:template match="nomenclaturalReference">
276
		<fo:inline>
277
			<xsl:value-of select="substring-after(titleCache, ../taggedName/e[last()]/text)"/>
278
		</fo:inline>
279
		<xsl:text> </xsl:text>
280
		<fo:inline>
281
			<xsl:value-of select="../nomenclaturalMicroReference"/>
282
		</fo:inline>
283
	</xsl:template>
284
	<!-- DESCRIPTIONS -->
285
	<xsl:template match="descriptions">
286
		<fo:block margin-bottom="5mm">
287
			<xsl:for-each select="features/feature">
288
				<fo:block text-indent="{$global-indentation}" text-align="justify">
289
					<xsl:choose>
290
						<xsl:when test="count(feature)!=0">
291
							<xsl:call-template name="secondLevelDescriptionElements"/>
292
						</xsl:when>
293
						<xsl:otherwise>
294
							<!-- everything except Citation -->
295
							<xsl:if test="uuid!='99b2842f-9aa7-42fa-bd5f-7285311e0101'"><xsl:value-of select="representation_L10n"/> - <xsl:call-template name="descriptionElements"/>
357 296
              </xsl:if>
358
            </xsl:otherwise>
359
          </xsl:choose>
360
        </fo:block>
361
      </xsl:for-each>
362
    </fo:block>
363
  </xsl:template>
364

  
365
  <xsl:template name="descriptionElements">
366
    <!--xsl:choose>
297
						</xsl:otherwise>
298
					</xsl:choose>
299
				</fo:block>
300
			</xsl:for-each>
301
		</fo:block>
302
	</xsl:template>
303
	<xsl:template name="descriptionElements">
304
		<!--xsl:choose>
367 305
      <xsl:when test="supportsDistribution='true'">
368 306
        <xsl:call-template name="distribution"/>
369 307
      </xsl:when>
......
371 309
        <xsl:call-template name="commonTaxonName"/>
372 310
      </xsl:when>
373 311
      <xsl:otherwise-->
374
    <xsl:call-template name="textData"/>
375
    <!--/xsl:otherwise>
312
		<xsl:call-template name="textData"/>
313
		<!--/xsl:otherwise>
376 314
    </xsl:choose-->
377
  </xsl:template>
378

  
379
  <xsl:template name="secondLevelDescriptionElements">
380
    <xsl:for-each select="feature">
381
      <fo:inline>
382
        <xsl:choose>
383
          <!-- Lifeform -->
384
          <!-- should not show the feature name -->
385
          <xsl:when test="uuid='db9228d3-8bbf-4460-abfe-0b1326c82f8e'">
386
            <xsl:for-each select="descriptionelements/descriptionelement">
387
              <fo:inline>
388
                <xsl:value-of select="multilanguageText_L10n/text"/>
389
              </fo:inline>
390
            </xsl:for-each>
391
          </xsl:when>
392
          <xsl:otherwise>
393
            <fo:inline font-style="italic">
394
              <xsl:value-of select="representation_L10n"/>
395
            </fo:inline>
396
            <xsl:for-each select="descriptionelements/descriptionelement">
397
              <fo:inline>
398
                <xsl:value-of
399
                  select="substring-after(multilanguageText_L10n/text, ../../representation_L10n)"/>
400
              </fo:inline>
401
            </xsl:for-each>
402
          </xsl:otherwise>
403
        </xsl:choose>
404
      </fo:inline>
405
    </xsl:for-each>
406
  </xsl:template>
407

  
408
  <xsl:template name="commonTaxonName">
409
    <xsl:for-each select="descriptionelements/descriptionelement">
410
      <fo:inline>
411
        <xsl:value-of select="language/representation_L10n"/> (<xsl:value-of
412
          select="area/representation_L10n"/>), </fo:inline>
413
    </xsl:for-each>
414
  </xsl:template>
415

  
416
  <xsl:template name="distribution">
417
    <xsl:for-each select="descriptionelements/descriptionelement">
418
      <fo:inline>
419
        <xsl:value-of select="area/representation_L10n"/> (<xsl:value-of
420
          select="status/representation_L10n"/>), </fo:inline>
421
    </xsl:for-each>
422
  </xsl:template>
423

  
424
  <xsl:template name="textData">
425
    <xsl:for-each select="descriptionelements/descriptionelement">
426
      <fo:inline>
427
        <xsl:apply-templates select="multilanguageText_L10n/text"/>
428
      </fo:inline>
429
    </xsl:for-each>
430
  </xsl:template>
431

  
432

  
433
  <!-- SYNONYMY BLOCK -->
434

  
435
  <xsl:template match="synonymy" name="synonymy">
436
    <fo:block margin-bottom="5mm">
437
      <fo:block line-height="{$global-line-height}" text-align="justify"
438
        text-indent="-{$global-indentation}" start-indent="{$global-indentation}">
439
        <xsl:apply-templates select="../name"/>
440
        <xsl:call-template name="citations"/>
441
        <xsl:apply-templates select="homotypicSynonymsByHomotypicGroup"/>
442
        <xsl:apply-templates select="../name/typeDesignations"/>
443
      </fo:block>
444
      <xsl:apply-templates select="heterotypicSynonymyGroups"/>
445
    </fo:block>
446
  </xsl:template>
447

  
448
  <xsl:template match="homotypicSynonymsByHomotypicGroup">
449
    <xsl:for-each select="e">
450
      <xsl:text> - </xsl:text>
451
      <xsl:apply-templates select="name"/>
452
    </xsl:for-each>
453
  </xsl:template>
454

  
455
  <xsl:template match="heterotypicSynonymyGroups">
456
    <xsl:for-each select="e">
457
      <fo:block line-height="{$global-line-height}" text-align="start"
458
        text-indent="-{$global-indentation}" start-indent="{$global-indentation}">
459
        <xsl:for-each select="e">
460
          <xsl:apply-templates select="name"/>
461
        </xsl:for-each>
462
        <xsl:apply-templates select="e[1]/name/typeDesignations" />
463
      </fo:block>
464
    </xsl:for-each>
465
  </xsl:template>
466

  
467
  <xsl:template name="citations">
468
    <xsl:for-each
469
      select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements/descriptionelement">
470
      <!-- TODO sorting only works for the first citation, implement correctly -->
471
      <xsl:sort select="sources/e[1]/citation/datePublished/start"/>
472
      <xsl:for-each select="sources/e">
473
        <xsl:text>; </xsl:text>
474
        <fo:inline>
475
          <xsl:value-of select="substring-before(citation/titleCache, citation/datePublished/start)"/>
476
          <xsl:value-of select="concat('(', citation/datePublished/start, ')')"/>
477
          <xsl:text> </xsl:text>
478
          <xsl:value-of select="citationMicroReference"/>
479
        </fo:inline>
480
      </xsl:for-each>
481
    </xsl:for-each>
482
  </xsl:template>
483

  
484
  <xsl:template match="typeDesignations">
485
    <xsl:for-each select="child::*">
486
      <fo:inline>
487
        <xsl:text> - Type: </xsl:text>
488
        <xsl:choose>
489
          <xsl:when test="class='SpecimenTypeDesignation'">
490
            <xsl:value-of select="typeSpecimen/titleCache"/>
491
          </xsl:when>
492
        </xsl:choose>
493
      </fo:inline>
494
    </xsl:for-each>
495
  </xsl:template>
496

  
315
	</xsl:template>
316
	<xsl:template name="secondLevelDescriptionElements">
317
		<xsl:for-each select="feature">
318
			<fo:inline>
319
				<xsl:text> </xsl:text>
320
				<xsl:choose>
321
					<!-- Lifeform -->
322
					<!-- should not show the feature name -->
323
					<xsl:when test="uuid='db9228d3-8bbf-4460-abfe-0b1326c82f8e'">
324
						<xsl:for-each select="descriptionelements/descriptionelement">
325
							<fo:inline>
326
								<xsl:value-of select="multilanguageText_L10n/text"/>
327
							</fo:inline>
328
						</xsl:for-each>
329
					</xsl:when>
330
					<xsl:otherwise>
331
						<fo:inline font-style="italic">
332
							<xsl:value-of select="representation_L10n"/>
333
						</fo:inline>
334
						<xsl:for-each select="descriptionelements/descriptionelement">
335
							<fo:inline>
336
								<xsl:value-of select="substring-after(multilanguageText_L10n/text, ../../representation_L10n)"/>
337
							</fo:inline>
338
						</xsl:for-each>
339
					</xsl:otherwise>
340
				</xsl:choose>
341
			</fo:inline>
342
		</xsl:for-each>
343
	</xsl:template>
344
	<xsl:template name="commonTaxonName">
345
		<xsl:for-each select="descriptionelements/descriptionelement">
346
			<fo:inline><xsl:value-of select="language/representation_L10n"/> (<xsl:value-of select="area/representation_L10n"/>), </fo:inline>
347
		</xsl:for-each>
348
	</xsl:template>
349
	<xsl:template name="distribution">
350
		<xsl:for-each select="descriptionelements/descriptionelement">
351
			<fo:inline><xsl:value-of select="area/representation_L10n"/> (<xsl:value-of select="status/representation_L10n"/>), </fo:inline>
352
		</xsl:for-each>
353
	</xsl:template>
354
	<xsl:template name="textData">
355
		<xsl:for-each select="descriptionelements/descriptionelement">
356
			<fo:inline>
357
				<xsl:apply-templates select="multilanguageText_L10n/text"/>
358
			</fo:inline>
359
		</xsl:for-each>
360
	</xsl:template>
361
	<!-- SYNONYMY BLOCK -->
362
	<xsl:template match="synonymy" name="synonymy">
363
		<fo:block margin-bottom="5mm">
364
			<fo:block line-height="{$global-line-height}" text-align="justify" text-indent="-{$global-indentation}" start-indent="{$global-indentation}">
365
				<xsl:apply-templates select="../name"/>
366
				<xsl:call-template name="citations"/>
367
				<xsl:apply-templates select="homotypicSynonymsByHomotypicGroup"/>
368
				<xsl:apply-templates select="../name/typeDesignations"/>
369
			</fo:block>
370
			<xsl:apply-templates select="heterotypicSynonymyGroups"/>
371
		</fo:block>
372
	</xsl:template>
373
	<xsl:template match="homotypicSynonymsByHomotypicGroup">
374
		<xsl:for-each select="e">
375
			<xsl:text> - </xsl:text>
376
			<xsl:apply-templates select="name"/>
377
		</xsl:for-each>
378
	</xsl:template>
379
	<xsl:template match="heterotypicSynonymyGroups">
380
		<xsl:for-each select="e">
381
			<fo:block line-height="{$global-line-height}" text-align="start" text-indent="-{$global-indentation}" start-indent="{$global-indentation}">
382
				<xsl:for-each select="e">
383
					<xsl:apply-templates select="name"/>
384
				</xsl:for-each>
385
				<xsl:apply-templates select="e[1]/name/typeDesignations"/>
386
			</fo:block>
387
		</xsl:for-each>
388
	</xsl:template>
389
	<xsl:template name="citations">
390
		<xsl:for-each select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements/descriptionelement">
391
			<!-- TODO sorting only works for the first citation, implement correctly -->
392
			<xsl:sort select="sources/e[1]/citation/datePublished/start"/>
393
			<xsl:for-each select="sources/e">
394
				<xsl:text>; </xsl:text>
395
				<fo:inline>
396
					<xsl:value-of select="substring-before(citation/titleCache, citation/datePublished/start)"/>
397
					<xsl:value-of select="concat('(', citation/datePublished/start, ')')"/>
398
					<xsl:text> </xsl:text>
399
					<xsl:value-of select="citationMicroReference"/>
400
				</fo:inline>
401
			</xsl:for-each>
402
		</xsl:for-each>
403
	</xsl:template>
404
	<xsl:template match="typeDesignations">
405
		<!-- DISABLING, BECAUSE IT IS CURRENTLY BROKEN IN REST SERVICE
406
		<xsl:for-each select="child::*">
407
			<fo:inline>
408
				<xsl:text> - Type: </xsl:text>
409
				<xsl:choose>
410
					<xsl:when test="class='SpecimenTypeDesignation'">
411
						<xsl:value-of select="typeSpecimen/titleCache"/>
412
					</xsl:when>
413
				</xsl:choose>
414
			</fo:inline>
415
		</xsl:for-each>
416
		-->
417
	</xsl:template>
497 418
</xsl:stylesheet>

Also available in: Unified diff