7d889c9f38a52be4412b20abd3102c47fe85c30a
[cdmlib.git] / cdmlib-print / src / main / resources / stylesheets / mediawiki / multipages.xsl
1 <!DOCTYPE xsl:stylesheet [<!ENTITY hyphen "&#45;" > <!ENTITY ndash "&#x2013;" >]>
2 <xsl:stylesheet version="2.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:functx="http://www.functx.com"
4 xmlns:fn="http://www.w3.org/2005/xpath-functions">
5
6 <xsl:import href="src/main/resources/stylesheets/mediawiki/functx-1.0-doc-2007-01.xsl" />
7 <!-- xsl:output method="xml" indent="no"/> -->
8 <xsl:strip-space elements="text" />
9
10 <!-- Authors: Sybille & Lorna -->
11 <!-- Date: March/April 2013 -->
12
13 <!--++++++++++ global vars (and templates used as such) +++++++++++++++++++++++++++ -->
14
15 <!-- mediawiki prefix -->
16 <xsl:param name="prefix"></xsl:param>
17 <xsl:variable name="page-prefix">
18 <!-- <xsl:text>Internal:</xsl:text> -->
19 <xsl:value-of select="$prefix"></xsl:value-of>
20 </xsl:variable>
21
22 <!-- create a timestamp for the whole going -->
23 <xsl:variable name="timestamp">
24 <xsl:value-of
25 select="concat(year-from-date(current-date()),'-',month-from-date(current-date()),'-',day-from-date(current-date()),'T',hours-from-time(current-time()),':',minutes-from-time(current-time()),':00Z')" />
26 </xsl:variable>
27
28 <!-- create the username who changed/created the pages -->
29 <xsl:param name="username"></xsl:param>
30 <xsl:variable name="u_name">
31 <xsl:value-of select="$username"></xsl:value-of>
32 </xsl:variable>
33
34 <xsl:template name="wiki-newline">
35 <xsl:text>&#xa;</xsl:text>
36 </xsl:template>
37
38 <xsl:template name="wiki-newline-comment">
39 <xsl:comment>
40 <xsl:text>&#xa; </xsl:text>
41 </xsl:comment>
42 </xsl:template>
43
44 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
45
46 <!-- this is the start template it creates the mediawiki tag surounding
47 and calls a template to create a page for every taxon node TODO: and a category -->
48 <xsl:template match="root">
49 <mediawiki xmlns="http://www.mediawiki.org/xml/export-0.7/"
50 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
51 xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.7.xsd"
52 version="0.7" xml:lang="en">
53 <siteinfo>
54 <sitename>TestWiki</sitename>
55 <base>http://biowikifarm.net/test/Main_Page</base>
56 <generator>MediaWiki 1.20.3</generator>
57 <case>first-letter</case>
58 <namespaces>
59 <namespace key="-2" case="first-letter">Media</namespace>
60 <namespace key="-1" case="first-letter">Special</namespace>
61 <namespace key="0" case="first-letter" />
62 <namespace key="1" case="first-letter">Talk</namespace>
63 <namespace key="2" case="first-letter">User</namespace>
64 <namespace key="3" case="first-letter">User talk</namespace>
65 <namespace key="4" case="first-letter">TestWiki</namespace>
66 <namespace key="5" case="first-letter">TestWiki talk</namespace>
67 <namespace key="6" case="first-letter">File</namespace>
68 <namespace key="7" case="first-letter">File talk</namespace>
69 <namespace key="8" case="first-letter">MediaWiki</namespace>
70 <namespace key="9" case="first-letter">MediaWiki talk</namespace>
71 <namespace key="10" case="first-letter">Template</namespace>
72 <namespace key="11" case="first-letter">Template talk</namespace>
73 <namespace key="12" case="first-letter">Help</namespace>
74 <namespace key="13" case="first-letter">Help talk</namespace>
75 <namespace key="14" case="first-letter">Category</namespace>
76 <namespace key="15" case="first-letter">Category talk</namespace>
77 <namespace key="102" case="first-letter">Property</namespace>
78 <namespace key="103" case="first-letter">Property talk</namespace>
79 <namespace key="106" case="first-letter">Form</namespace>
80 <namespace key="107" case="first-letter">Form talk</namespace>
81 <namespace key="108" case="first-letter">Concept</namespace>
82 <namespace key="109" case="first-letter">Concept talk</namespace>
83 <namespace key="170" case="first-letter">Filter</namespace>
84 <namespace key="171" case="first-letter">Filter talk</namespace>
85 <namespace key="198" case="first-letter">Internal</namespace>
86 <namespace key="199" case="first-letter">Internal talk</namespace>
87 <namespace key="200" case="first-letter">Portal</namespace>
88 <namespace key="201" case="first-letter">Portal talk</namespace>
89 <namespace key="202" case="first-letter">Bibliography</namespace>
90 <namespace key="203" case="first-letter">Bibliography talk</namespace>
91 <namespace key="204" case="first-letter">Draft</namespace>
92 <namespace key="205" case="first-letter">Draft talk</namespace>
93 <namespace key="206" case="first-letter">Submission</namespace>
94 <namespace key="207" case="first-letter">Submission talk</namespace>
95 <namespace key="208" case="first-letter">Reviewed</namespace>
96 <namespace key="209" case="first-letter">Reviewed talk</namespace>
97 <namespace key="420" case="first-letter">Layer</namespace>
98 <namespace key="421" case="first-letter">Layer talk</namespace>
99 </namespaces>
100 </siteinfo>
101 <xsl:apply-templates select="//TaxonNode" />
102 </mediawiki>
103 </xsl:template>
104
105 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
106
107 <!-- this creates a page and a category for every taxon node. -->
108 <!-- TODO create a template for page creating and for categorie creating -->
109 <xsl:template match="TaxonNode" name="TaxonNode">
110 <!-- as we will need the title more than once, we create a variable -->
111 <xsl:variable name="title">
112 <xsl:call-template name="title">
113 <xsl:with-param name="taxon" select="Taxon" />
114 </xsl:call-template>
115 </xsl:variable>
116
117 <!-- we also initialize the parent taxon variable if there is a higher
118 taxon assigned: -->
119
120 <xsl:variable name="parent-title">
121 <xsl:if test="exists(../..) and name(../..)='TaxonNode'">
122
123 <xsl:call-template name="title">
124 <xsl:with-param name="taxon" select="../../Taxon" />
125 </xsl:call-template>
126
127 </xsl:if>
128 <!-- else if no higher taxon could be found -->
129 <xsl:if test="not(exists(../..)) or not(name(../..)='TaxonNode')">
130
131 <xsl:text>{{EDIT No Parent available}}</xsl:text>
132
133 </xsl:if>
134 </xsl:variable>
135
136 <!-- create category -->
137 <xsl:text>
138 <!-- this creates a newline before the <page>
139 if it was not there, the page could not be imported by the mediawiki-->
140 </xsl:text>
141
142 <page>
143 <title>
144 <xsl:text>Category:</xsl:text>
145 <xsl:value-of select="$title" />
146 </title>
147 <revision>
148 <!-- TODO: create seconds without positions after decimal point! -->
149 <timestamp>
150 <xsl:value-of select="$timestamp" />
151 </timestamp>
152 <contributor>
153 <username>
154 <xsl:value-of select="$u_name"/>
155 </username>
156 </contributor>
157
158 <text>
159 <xsl:attribute name="xml:space">preserve</xsl:attribute>
160 <!-- redirekt to corresponding page -->
161 <xsl:value-of select="concat('#REDIRECT [[',$page-prefix,$title,']]')" />
162 <!-- add parent categorie if exists -->
163 <xsl:if test="exists(../..) and name(../..)='TaxonNode'">
164 <xsl:call-template name="wiki-newline" />
165 <xsl:value-of select="concat('[[Category:',$parent-title,']]')" />
166 </xsl:if>
167 </text>
168
169 </revision>
170 </page>
171
172 <!-- create taxon page -->
173 <page>
174 <title>
175 <xsl:value-of select="concat($page-prefix,$title)" />
176 </title>
177 <revision>
178 <!-- MAYDO: create seconds without positions after decimal point! -->
179 <timestamp>
180 <xsl:value-of select="$timestamp" />
181 </timestamp>
182 <contributor>
183 <username>
184 <xsl:value-of select="$username" />
185 </username>
186 </contributor>
187
188 <text>
189 <xsl:attribute name="xml:space">preserve</xsl:attribute>
190 <!-- add table of contents -->
191 <xsl:call-template name="TOC" />
192 <!-- add taxo tree -->
193 <xsl:value-of
194 select="concat('{{EDIT_Taxotree| parentTaxon=',$page-prefix,$parent-title,'}}')" />
195 <xsl:call-template name="wiki-newline" />
196 <xsl:call-template name="wiki-newline" />
197
198 <!-- add contents of taxon page -->
199 <xsl:apply-templates select="Taxon" />
200 <xsl:call-template name="display-references" />
201 <xsl:call-template name="wiki-newline" />
202 <xsl:call-template name="wiki-newline" />
203 <!-- put page to corresponding tax category -->
204 <xsl:value-of select="concat('[[Category:',$title, ']]')" />
205
206 </text>
207 </revision>
208 </page>
209
210 <!--<xsl:apply-templates select="//childNodes/TaxonNode/Taxon"/> -->
211 </xsl:template>
212
213 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
214
215 <!-- this template provides the correct name of a taxon parameter: taxon
216 the taxon we want to get the name from -->
217 <xsl:template name="title">
218 <xsl:param name="taxon" />
219 <xsl:choose>
220 <!-- family -->
221 <xsl:when
222 test="$taxon/name/rank/uuid='af5f2481-3192-403f-ae65-7c957a0f02b6'">
223 <xsl:call-template name="get-family-or-genus-title">
224 <xsl:with-param name="genusOrUninomial" select="$taxon/name/genusOrUninomial" />
225 </xsl:call-template>
226 </xsl:when>
227 <!-- genus -->
228 <xsl:when
229 test="$taxon/name/rank/uuid='1b11c34c-48a8-4efa-98d5-84f7f66ef43a'">
230 <xsl:call-template name="get-family-or-genus-title">
231 <xsl:with-param name="genusOrUninomial" select="$taxon/name/genusOrUninomial" />
232 </xsl:call-template>
233 </xsl:when>
234 <!--TODO -->
235 <!-- subgenus -->
236 <xsl:when
237 test="$taxon/name/rank/uuid='78786e16-2a70-48af-a608-494023b91904'">
238 <xsl:apply-templates select="$taxon/name/rank/representation_L10n" />
239 <xsl:text> </xsl:text>
240 <xsl:apply-templates select="$taxon/name/genusOrUninomial" />
241 </xsl:when>
242 <!-- species -->
243 <xsl:when
244 test="$taxon/name/rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d'">
245 <xsl:call-template name="get-species-title">
246 <xsl:with-param name="taxon" select="$taxon" />
247 </xsl:call-template>
248 </xsl:when>
249 <xsl:otherwise>
250 <!-- for debugging -->
251 Unformatted title for rank uuid:
252 <xsl:value-of select="$taxon/name/rank/uuid" />
253 :
254 <xsl:value-of select="$taxon/name/titleCache">
255 </xsl:value-of>
256 </xsl:otherwise>
257 </xsl:choose>
258 </xsl:template>
259
260 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
261
262 <!-- these templates create the name of the taxa wheater their kind is -->
263
264 <xsl:template name="get-family-or-genus-title">
265 <xsl:param name="genusOrUninomial" />
266 <xsl:value-of select="$genusOrUninomial" />
267 </xsl:template>
268
269 <xsl:template name="get-species-title">
270 <xsl:param name="taxon" />
271 <xsl:value-of
272 select="concat($taxon/name/genusOrUninomial, ' ', $taxon/name/specificEpithet)" />
273 </xsl:template>
274
275 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
276
277 <!-- we run this for the content of the page -->
278 <xsl:template match="Taxon" name="Taxon">
279 <xsl:apply-templates select="synonymy" />
280 <xsl:apply-templates select="key" />
281 <xsl:apply-templates select="descriptions" />
282 <!-- A change to Gallery: uncomment following line: -->
283 <xsl:call-template name="gallery"/>
284 <xsl:call-template name="featureGallery" />
285 <!-- TODO to change to Figure Gallery: call figure gallery in the right
286 place what else? -->
287 </xsl:template>
288
289 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
290
291 <!-- these templates provide the citations -->
292
293 <xsl:template name="display-references">
294 <xsl:text>{{EDIT_Reference_Section}}</xsl:text>
295 </xsl:template>
296
297
298 <xsl:template name="citations">
299 <xsl:param name="name-uuid" />
300 <xsl:param name="descriptionelements" />
301
302 <!--<ref name="{$name-uuid}"> -->
303 <!-- iterate through all the description elements for the citation feature -->
304 <xsl:for-each select="$descriptionelements/descriptionelement">
305
306 <xsl:sort select="sources/e[1]/citation/datePublished/start" />
307
308 <xsl:variable name="citation-uuid" select="sources/e[1]/citation/uuid" />
309
310 <xsl:for-each select="sources/e">
311 <xsl:if test="nameUsedInSource/uuid=$name-uuid">
312
313 <!-- call reference template with sources/e/citation -->
314 <xsl:call-template name="reference">
315 <xsl:with-param name="reference-node" select="citation" />
316 </xsl:call-template>
317 <!-- use the citation-uuid as a unique name for the reference -->
318
319 </xsl:if>
320 </xsl:for-each>
321 <!--</ref> -->
322 </xsl:for-each>
323
324 </xsl:template>
325
326 <!-- an example of mediawiki formtting of references: Mohrig, W.; Menzel,
327 F. 1992: Neue Arten europäischer Trauermücken (Diptera, Sciaridae). An International
328 Journal of Dipterological Research, 3(1-2), 1–16. Authors Date: title. inReferences
329 title in italics, Volume in bold(series), page range -->
330 <xsl:template name="reference">
331 <xsl:param name="reference-node" />
332 <!--TODO Do we need to sort the list of references in WikiMedia or will
333 they just appear in numbered order as they occur in the names -->
334 <!--xsl:sort select="sources/e[1]/citation/datePublished/start"/ -->
335
336 <!-- first of all check if any of the data we show exist: TODO remove this
337 test, if we modified CDM services, to export proper data -->
338 <xsl:if
339 test="exists($reference-node/authorTeam/teamMembers/e[1]/lastname)
340 or exists($reference-node/authorTeam/lastname) or exists($reference-node/datePublished/start)
341 or exists($reference-node/title)">
342
343 <!-- use the citation-uuid as a unique name for the reference -->
344 <xsl:variable name="citation-uuid" select="$reference-node/uuid" />
345
346 <!-- use the citation-uuid as a unique name for the reference -->
347 <xsl:value-of
348 select="concat('{{EDIT_Reference|name=',$citation-uuid,'|content=')" />
349
350 <xsl:choose>
351 <xsl:when test="exists($reference-node/authorTeam/teamMembers)">
352 <xsl:text>{{aut|</xsl:text>
353 <xsl:for-each select="$reference-node/authorTeam/teamMembers/e">
354 <xsl:value-of select="lastname" />
355 <xsl:choose>
356 <xsl:when test="position() != last()">
357 <xsl:text> &amp; </xsl:text>
358 </xsl:when>
359 </xsl:choose>
360 </xsl:for-each>
361 <xsl:text>}} </xsl:text>
362 </xsl:when>
363 <xsl:otherwise>
364 <xsl:choose>
365 <xsl:when test="exists($reference-node/authorTeam/lastname)">
366 <xsl:text>{{aut|</xsl:text>
367 <xsl:value-of select="$reference-node/authorTeam/lastname" />
368 <xsl:text>}} </xsl:text>
369 </xsl:when>
370 <xsl:otherwise>
371 <xsl:value-of select="$reference-node/titleCache"></xsl:value-of>
372 </xsl:otherwise>
373 </xsl:choose>
374
375 </xsl:otherwise>
376
377 </xsl:choose>
378
379 <!-- DEBUGGING display uuid so can check references against those in Tax
380 Editor -->
381 <!--<xsl:if test="$reference-node/datePublished/start != ''"> <xsl:value-of
382 select="$reference-node/datePublished/start"/> <xsl:text>: </xsl:text> </xsl:if> -->
383 <xsl:apply-templates select="$reference-node/title" />
384 <!-- do we need any other info from inReference node - see flore-afrique-centrale.xsl
385 xsl -->
386 <xsl:variable name="wiki-markup">
387 ''
388 </xsl:variable>
389
390 <xsl:if test="$reference-node/inReference/node()">
391 <xsl:value-of
392 select="concat($wiki-markup, $reference-node/inReference/title, $wiki-markup)" />
393 </xsl:if>
394 <xsl:apply-templates select="$reference-node/volume" />
395 <xsl:apply-templates select="$reference-node/series" />
396 <xsl:apply-templates select="$reference-node/pages" />
397 <xsl:apply-templates select="$reference-node/placePublished" />
398 <xsl:apply-templates select="$reference-node/publisher" />
399
400 <!--xsl:choose> <xsl:when test="$reference-node/inReference/node()"> <xsl:value-of
401 select="$reference-node/title"/> <xsl:text>. </xsl:text> <xsl:value-of select="$reference-node/inReference/title"/>
402 </xsl:when> <xsl:otherwise> <xsl:value-of select="$reference-node/title"/>
403 </xsl:otherwise> </xsl:choose> <xsl:text>.</xsl:text> <xsl:value-of select="$reference-node/pages"/>
404 <xsl:text>.</xsl:text> <xsl:if test="$reference-node/type = 'Book' or $reference-node/type
405 = 'BookSection'"> <xsl:if test="$reference-node/placePublished != '' or $reference-node/publisher
406 != ''"> <xsl:text> </xsl:text> <xsl:value-of select="$reference-node/placePublished"/>
407 <xsl:text>, </xsl:text> <xsl:value-of select="$reference-node/publisher"/>
408 <xsl:text>.</xsl:text> </xsl:if> </xsl:if -->
409 <xsl:text>}}</xsl:text>
410 </xsl:if>
411 <!--</ref> -->
412 <xsl:call-template name="wiki-newline-comment" />
413 </xsl:template>
414
415 <!-- wild card match for different children of nomenclaturalReference and
416 citaion nodes -->
417 <xsl:template match="*">
418
419 <xsl:choose>
420 <xsl:when test="name(.) = 'pages'">
421 <xsl:value-of select="replace(.,'&hyphen;','&ndash;')" />
422 </xsl:when>
423 <xsl:otherwise>
424 <xsl:value-of select="." />
425 </xsl:otherwise>
426 </xsl:choose>
427
428 <!--<xsl:text>FOO </xsl:text> -->
429 <xsl:if
430 test="name(.) = 'title' or name(.) = 'publisher' or name(.) = 'pages'">
431 <!-- . if publisher or title - comma if placePublished -->
432 <xsl:text>. </xsl:text>
433 </xsl:if>
434
435 <xsl:if test="name(.) = 'volume'">
436 <xsl:text>: </xsl:text>
437 </xsl:if>
438 <xsl:if
439 test="(../type = 'Book' or ../type = 'BookSection') and name(.) = 'placePublished' and . != ''">
440 <xsl:text>, </xsl:text>
441 </xsl:if>
442 </xsl:template>
443 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
444
445 <!-- these templates provide the polytomous key For example: {{Lead | 1=4|
446 2= jeunes couverts de cils simples et glanduleux mais jamais de cils denticulés
447 ou branchus| result = Erica trimera (Flora of XX) | result text = ''Erica
448 trimera''}} -->
449 <xsl:template match="key" name="key">
450
451 <xsl:param name="uuidFamily">
452 210a8214-4e69-401a-8e47-c7940d990bdd
453 </xsl:param>
454 <xsl:param name="uuidGenus">
455 1b11c34c-48a8-4efa-98d5-84f7f66ef43a
456 </xsl:param>
457 <xsl:param name="uuidSubgenus">
458 78786e16-2a70-48af-a608-494023b91904
459 </xsl:param>
460
461 <xsl:if test="HashMap/records/e">
462
463 <xsl:call-template name="chapter">
464 <xsl:with-param name="title">
465 Key
466 </xsl:with-param>
467 </xsl:call-template>
468
469 <xsl:variable name="key-name" select="HashMap/titleCache" />
470 <xsl:value-of
471 select="concat('{{Key Start | id =',$key-name,'|title=',$key-name,'|edited by=L.Morris}}')" />
472
473
474 <!--xsl:if test="ArrayList/e" -->
475 <xsl:for-each select="HashMap/records/e">
476
477 <xsl:variable name="node-number" select="nodeNumber" />
478 <xsl:variable name="child-statement" select="childStatement" />
479
480 <!-- TaxonLinkDto or PolytomousKeyNodeLinkDto -->
481 <!--xsl:value-of select="concat('{{Decision | id =', $node-number, '|
482 lead 1 = ', $child-statement)"/ -->
483 <xsl:value-of select="concat('{{Lead | 1 =', $node-number)" />
484
485 <xsl:if test="edgeNumber = 2">
486 <xsl:text>*</xsl:text>
487 </xsl:if>
488
489 <xsl:value-of select="concat('| 2 =', $child-statement)" />
490
491
492 <xsl:choose>
493 <xsl:when test="links/e[1]/class = 'PolytomousKeyNodeLinkDto'">
494 <xsl:variable name="link-node-number" select="links/e[1]/nodeNumber" />
495 <xsl:value-of select="concat('| 3 =', $link-node-number)" />
496 </xsl:when>
497 <xsl:when test="links/e[1]/class = 'TaxonLinkDto'">
498
499 <xsl:text>| result = '' </xsl:text>
500 <xsl:variable name="taxonUuid" select="links/e[1]/uuid" />
501 <xsl:variable name="genus"
502 select="//Taxon/uuid[.=$taxonUuid]/../name/genusOrUninomial" />
503 <xsl:choose>
504 <xsl:when test="taxonUuid = $uuidSubgenus">
505 <xsl:variable name="repr"
506 select="//Taxon/uuid[.='71cd0e8d-47eb-4c66-829a-e21c705ee660']/../name/rank/representation_L10n" />
507 <xsl:value-of select="concat($genus, '. ', $repr)" />
508 </xsl:when>
509 <xsl:when test="taxonUuid = $uuidGenus">
510 <xsl:apply-templates select="$genus" />
511 </xsl:when>
512 <xsl:otherwise>
513 <xsl:variable name="specificEpithet"
514 select="//Taxon/uuid[.=$taxonUuid]/../name/specificEpithet" />
515 <!-- abbreviate the genus for species names -->
516 <xsl:value-of select="concat($genus, ' ', $specificEpithet)" />
517 </xsl:otherwise>
518 </xsl:choose>
519 <xsl:text>''</xsl:text>
520 </xsl:when>
521 <xsl:otherwise />
522 </xsl:choose>
523
524 <xsl:text>}}</xsl:text>
525
526 </xsl:for-each>
527
528 <xsl:text>{{Key End}}</xsl:text>
529 <xsl:call-template name="wiki-newline"></xsl:call-template>
530 </xsl:if>
531
532 </xsl:template>
533
534
535 <!-- these templates provide the synonomy -->
536
537 <xsl:template match="synonymy" name="synonymy">
538 <xsl:call-template name="chapter">
539 <xsl:with-param name="title">
540 Synonomy
541 </xsl:with-param>
542 </xsl:call-template>
543 <!--<xsl:text>{{EDIT_Taxon|</xsl:text> -->
544 <xsl:apply-templates select="../name">
545 <xsl:with-param name="type">
546 Taxon
547 </xsl:with-param>
548 </xsl:apply-templates>
549 <!--<xsl:text>}}</xsl:text> -->
550 <xsl:call-template name="wiki-newline" />
551 <!-- getting nomenclatural refs and citaions for this name -->
552 <xsl:call-template name="reference">
553 <xsl:with-param name="reference-node" select="../name/nomenclaturalReference" />
554 </xsl:call-template>
555 <xsl:call-template name="citations">
556 <xsl:with-param name="descriptionelements"
557 select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements" />
558 <xsl:with-param name="name-uuid" select="../name/uuid" />
559 </xsl:call-template>
560 <xsl:apply-templates select="homotypicSynonymsByHomotypicGroup" />
561 <xsl:apply-templates select="heterotypicSynonymyGroups" />
562 <xsl:call-template name="wiki-newline" />
563 <xsl:call-template name="wiki-newline" />
564 <!--xsl:call-template name="citations"> <xsl:with-param name="descriptionelements"
565 select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements"/>
566 <xsl:with-param name="name-uuid" select="../name/uuid"/> </xsl:call-template -->
567 </xsl:template>
568
569 <!--............................................. -->
570
571 <xsl:template match="homotypicSynonymsByHomotypicGroup">
572 <xsl:for-each select="e">
573 <xsl:text>{{EDIT Homotypic Synonym|1|</xsl:text>
574 <xsl:apply-templates select="name" />
575 <xsl:text>}}</xsl:text>
576 <xsl:call-template name="wiki-newline-comment" />
577 <!--homotypicSynonymsByHomotypicGroup/e/name/nomenclaturalReference -->
578 <!--xsl:apply-templates select="name/nomenclaturalReference"/ -->
579 <xsl:for-each select="name/homotypicalGroup/typifiedNames/e">
580 <xsl:call-template name="reference">
581 <xsl:with-param name="reference-node" select="nomenclaturalReference" />
582 </xsl:call-template>
583 </xsl:for-each>
584 <xsl:call-template name="reference">
585 <xsl:with-param name="reference-node" select="name/nomenclaturalReference" />
586
587
588 </xsl:call-template>
589
590 <!--LORNA Pass the description elements for the citation 99b2842f-9aa7-42fa-bd5f-7285311e0101 -->
591 <xsl:call-template name="citations">
592 <xsl:with-param name="descriptionelements"
593 select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements" />
594 <xsl:with-param name="name-uuid" select="name/uuid" />
595 </xsl:call-template>
596 </xsl:for-each>
597 </xsl:template>
598
599 <!--............................................. -->
600
601 <xsl:template match="heterotypicSynonymyGroups">
602 <xsl:for-each select="e">
603 <!-- take the first one to printout as the head of the homotypic group -->
604 <xsl:variable name="first-element" select="e[1]" />
605 <xsl:text>{{EDIT Heterotypic Synonym|1|</xsl:text>
606 <xsl:apply-templates select="$first-element/name" />
607 <xsl:text>}}</xsl:text>
608
609 <xsl:call-template name="wiki-newline-comment" />
610 <xsl:call-template name="reference">
611 <xsl:with-param name="reference-node" select="$first-element/name/nomenclaturalReference" />
612 </xsl:call-template>
613
614 <xsl:for-each select="name/homotypicalGroup/typifiedNames/e">
615 <xsl:call-template name="reference">
616 <xsl:with-param name="reference-node" select="$first-element/nomenclaturalReference" />
617 </xsl:call-template>
618 </xsl:for-each>
619
620 <!-- take the first one to printout as the head of the homotypic group -->
621 <!--do foreach for the rest -->
622 <xsl:for-each select="e[position() &gt; 1]">
623 <!--xsl:for-each select="e"-->
624 <xsl:text>{{EDIT Homotypic Synonym|2|</xsl:text>
625 <xsl:apply-templates select="name" />
626 <xsl:text>}}</xsl:text>
627 <xsl:call-template name="wiki-newline-comment" />
628 <xsl:call-template name="reference">
629 <xsl:with-param name="reference-node" select="name/nomenclaturalReference" />
630 </xsl:call-template>
631
632 <xsl:for-each select="name/homotypicalGroup/typifiedNames/e">
633 <xsl:call-template name="reference">
634 <xsl:with-param name="reference-node" select="nomenclaturalReference" />
635 </xsl:call-template>
636 </xsl:for-each>
637
638 <!--LORNA Pass the description elements for the citation 99b2842f-9aa7-42fa-bd5f-7285311e0101 -->
639 <xsl:call-template name="citations">
640 <xsl:with-param name="descriptionelements"
641 select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements" />
642 <xsl:with-param name="name-uuid" select="name/uuid" />
643 </xsl:call-template>
644 </xsl:for-each>
645 </xsl:for-each>
646 <!--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 -->
647 </xsl:template>
648
649 <!--............................................. -->
650
651 <xsl:template match="name" name="name">
652 <xsl:param name="type" />
653 <xsl:apply-templates select="taggedName">
654 <xsl:with-param name="type" select="$type" />
655 </xsl:apply-templates>
656 <!--xsl:apply-templates select="nomenclaturalReference"/ -->
657 </xsl:template>
658
659 <!--............................................. -->
660
661 <xsl:template match="taggedName">
662 <xsl:param name="type" />
663 <xsl:choose>
664 <xsl:when test="$type!=''">
665 <xsl:value-of select="concat('{{EDIT_',normalize-space($type),'|')" />
666 <xsl:for-each select="e">
667 <xsl:choose>
668 <xsl:when test="type='name'">
669 <xsl:apply-templates select="text" />
670 <xsl:text> </xsl:text>
671 </xsl:when>
672 <xsl:when test="type='authors'">
673 <xsl:text>}}</xsl:text>
674 <xsl:value-of select="concat('{{EDIT_',normalize-space($type),'_Author|')" />
675 <xsl:apply-templates select="text" />
676 <xsl:text>}}</xsl:text>
677 </xsl:when>
678 </xsl:choose>
679 </xsl:for-each>
680 </xsl:when>
681 <xsl:otherwise>
682 <xsl:for-each select="e">
683 <xsl:apply-templates select="text" />
684 <xsl:text> </xsl:text>
685 </xsl:for-each>
686 </xsl:otherwise>
687 </xsl:choose>
688
689
690
691
692 <!-- TODO mybe some types don't contain font tags, we don't have to call
693 the tmeplate -->
694 <!-- we could just use <xsl:value-of select="text"/> -->
695
696
697 <!--<xsl:text>&#xA;</xsl:text> -->
698 </xsl:template>
699
700 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
701
702 <!-- description features -->
703
704 <!-- TODO: for first and second level: check if there is a page that describes
705 the feature and use Parameter "Link=pagename" with templates Tax_Feature
706 or Second_Level_Feature -->
707
708 <xsl:template match="descriptions" name="descriptions">
709 <xsl:call-template name="wiki-comment">
710 <xsl:with-param name="wiki-comment">
711 FEATURES
712 </xsl:with-param>
713 </xsl:call-template>
714 <xsl:for-each select="features/feature">
715 <xsl:choose>
716 <xsl:when test="count(feature)!=0">
717 <xsl:call-template name="secondLevelDescriptionElements" />
718 </xsl:when>
719 <xsl:otherwise>
720 <!-- everything but Citation -->
721 <xsl:if test="uuid!='99b2842f-9aa7-42fa-bd5f-7285311e0101'">
722 <xsl:call-template name="descriptionElements" />
723 </xsl:if>
724 <!--xsl:apply-templates select="media/e/representations/e/parts/e/uri"/ -->
725 </xsl:otherwise>
726 </xsl:choose>
727 </xsl:for-each>
728
729 </xsl:template>
730
731 <!--............................................. -->
732
733 <xsl:template name="secondLevelDescriptionElements">
734
735 <xsl:value-of
736 select="concat('{{EDIT_Highlevel_Feature|',representation_L10n,'}}')" />
737 <xsl:call-template name="wiki-newline" />
738 <xsl:for-each select="feature">
739 <!-- TODO assign TermBase description to parameter description- after
740 exporting it from CDM -->
741 <xsl:if test="uuid!='6dfb4e78-c67e-410c-8989-c1fb1295abf6'">
742 <xsl:value-of
743 select="concat('{{EDIT_Nested_Feature|name=',representation_L10n,'|description=',representation_L10n,'|elements=')" />
744 <xsl:call-template name="wiki-newline" />
745 <!-- TODO create Elements -->
746 <xsl:for-each select="descriptionelements/descriptionelement">
747 <xsl:value-of
748 select="concat('{{EDIT_Nested_Feature_Element|',multilanguageText_L10n/text, '}}')" />
749 <xsl:choose>
750 <xsl:when test="position() != last()">
751 <xsl:text>{{EDIT_Delimiter}}</xsl:text>
752 </xsl:when>
753 </xsl:choose>
754 <xsl:if test="position() != last()">
755 <xsl:call-template name="wiki-newline" />
756 </xsl:if>
757 </xsl:for-each>
758 <xsl:text>}}</xsl:text>
759 <xsl:call-template name="wiki-newline" />
760 </xsl:if>
761 </xsl:for-each>
762 <xsl:for-each select="feature">
763 <xsl:if test="uuid='6dfb4e78-c67e-410c-8989-c1fb1295abf6'">
764 <xsl:call-template name="featureGallery" />
765 </xsl:if>
766 </xsl:for-each>
767 <xsl:call-template name="wiki-newline" />
768
769 </xsl:template>
770 <!--............................................. -->
771
772
773 <xsl:template name="descriptionElements">
774 <xsl:choose>
775 <xsl:when test="supportsCommonTaxonName='true'">
776 <!-- must be Vernacular Name feature -->
777 <xsl:call-template name="commonTaxonName" />
778 </xsl:when>
779 <xsl:otherwise>
780 <!-- for example Habitat, Material Examined -->
781 <xsl:call-template name="textData" />
782 </xsl:otherwise>
783 </xsl:choose>
784 </xsl:template>
785
786 <!--............................................. -->
787
788 <xsl:template name="commonTaxonName">
789
790 <xsl:value-of
791 select="concat('{{EDIT_Feature|name=',representation_L10n,'|elements=')" />
792 <xsl:call-template name="wiki-newline" />
793 <xsl:for-each select="descriptionelements/descriptionelement">
794 <xsl:text />
795 <xsl:value-of
796 select="concat('{{EDIT_Common_Name|name=',name,'|language=',language/representation_L10n,'}}')" />
797 <xsl:choose>
798 <xsl:when test="position() != last()">
799 <xsl:text>{{EDIT_Delimiter}}</xsl:text>
800 <xsl:call-template name="wiki-newline" />
801 </xsl:when>
802 </xsl:choose>
803 </xsl:for-each>
804 <xsl:text>}}</xsl:text>
805 <xsl:call-template name="wiki-newline" />
806 <xsl:call-template name="wiki-newline" />
807 </xsl:template>
808
809 <!--............................................. -->
810
811 <xsl:template name="textData">
812 <xsl:value-of
813 select="concat('{{EDIT_Feature|name=',representation_L10n, '|elements=')" />
814 <xsl:call-template name="wiki-newline" />
815 <xsl:text>{{EDIT_Feature_Text|</xsl:text>
816 <!-- <xsl:choose> <xsl:when test="uuid!='9fc9d10c-ba50-49ee-b174-ce83fc3f80c6'"> -->
817 <!-- feature is not "Distribution" -->
818
819 <xsl:apply-templates
820 select="descriptionelements/descriptionelement[1]/multilanguageText_L10n/text" />
821 <!-- </xsl:when> </xsl:choose> -->
822 <xsl:text>}}}}</xsl:text>
823 <!-- feature is "Figures -->
824 <!-- A Gallery: uncomment following line -->
825 <!--<xsl:apply-templates select="descriptionelements/descriptionelement[1]/multilanguageText_L10n/text"/> -->
826 <!-- A Gallery: comment following line -->
827 <!--xsl:call-template name="gallery"/-->
828
829 <xsl:call-template name="wiki-newline" />
830 <xsl:call-template name="wiki-newline" />
831 <!-- LORNA TRY IMAGE HERE -->
832 <!--xsl:apply-templates select="descriptionelements/descriptionelement[1]/media/e/representations/e/parts/e/uri"/ -->
833
834
835 </xsl:template>
836
837 <!--............................................. -->
838
839
840 <xsl:template match="text">
841
842 <xsl:call-template name="replace-tags">
843 <xsl:with-param name="text-string" select="." />
844 </xsl:call-template>
845 </xsl:template>
846
847 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
848 <!-- image galleries -->
849
850 <xsl:template name="gallery">
851 <!-- A change to Figure Gallery: delete/comment following line -->
852 <xsl:text>{{EDIT_Gallery|files=</xsl:text>
853 <!-- A change to Figure Gallery: uncomment following line -->
854 <!--<xsl:text>{{EDIT_Figure_Gallery|files=</xsl:text> -->
855 <xsl:call-template name="wiki-newline" />
856 <xsl:apply-templates select="../media/e/representations/e/parts/e/uri" />
857
858 <xsl:text>}}</xsl:text>
859 <xsl:call-template name="wiki-newline" />
860 <xsl:call-template name="wiki-newline" />
861 </xsl:template>
862
863
864 <xsl:template name="featureGallery">
865
866 <xsl:value-of
867 select="concat('{{EDIT_Nested_Feature|name=',representation_L10n,'|description=',representation_L10n,'|elements=}}')" />
868 <xsl:text>{{EDIT_Figure_Gallery|files=</xsl:text>
869 <xsl:text />
870 <xsl:call-template name="wiki-newline" />
871 <xsl:apply-templates select=".//media/e/representations/e/parts/e/uri" />
872
873 <xsl:text>}}</xsl:text>
874 <xsl:call-template name="wiki-newline" />
875 <xsl:call-template name="wiki-newline" />
876
877 <xsl:call-template name="gallery_file" />
878
879 </xsl:template>
880
881
882 <xsl:template name="gallery_file" />
883
884 <xsl:template match="media/e/representations/e/parts/e/uri">
885
886 <xsl:value-of
887 select="concat('{{EDIT_Gallery_File|filename=',functx:substring-after-last(.,'/'), '|description=')" />
888 <!--go back up to the description element and get the text for the Figure
889 legend -->
890 <xsl:apply-templates
891 select="../../../../../../../multilanguageText_L10n/text" />
892 <xsl:text>}}</xsl:text>
893 <xsl:if test="position() != last()">
894 <xsl:call-template name="wiki-newline" />
895 </xsl:if>
896 </xsl:template>
897
898
899
900
901 <!--+++++++++++++++++++++++++++++L A Y O U T ++++++++++++++++++++++++++++++++++++++ -->
902
903
904 <!-- change here to change the look of the mediawiki output -->
905 <!-- please use mediawiki templates -->
906 <!-- think also of template changes in the mediawiki -->
907
908 <xsl:template name="TOC">
909 {{EDIT_TOC}}
910 </xsl:template>
911
912 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
913 <xsl:template name="chapter">
914 <xsl:param name="title" />
915 <xsl:value-of select="concat('{{EDIT_Section|title=',$title,'}}')" />
916 <xsl:call-template name="wiki-newline" />
917 <xsl:call-template name="wiki-newline" />
918 </xsl:template>
919
920 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
921
922 <xsl:template name="subchapter">
923 <xsl:param name="title" />
924 <xsl:value-of select="concat('{{EDIT_Subsection|title=',$title,'}}')" />
925 <xsl:call-template name="wiki-newline" />
926 <xsl:call-template name="wiki-newline" />
927 </xsl:template>
928
929 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
930 <!-- puts in a wiki comment -->
931 <xsl:template name="wiki-comment">
932 <xsl:param name="wiki-comment" />
933 <xsl:comment>
934 <xsl:value-of select="concat($wiki-comment,'&#xa;')" />
935 </xsl:comment>
936 </xsl:template>
937
938 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
939
940 <!--this template layouts and displays the name of a taxon depending on
941 it's "kind" MAYDO: create more useful layouts instead of title sizes -->
942 <xsl:template name="display-taxon-name">
943 <xsl:param name="taxon" />
944 <!-- get the name of the taxon -->
945 <xsl:variable name="name">
946 <xsl:call-template name="title">
947 <xsl:with-param name="taxon" select="$taxon" />
948 </xsl:call-template>
949 </xsl:variable>
950 <!-- format the name of the taxon according to it's kind -->
951 <xsl:choose>
952 <!-- family -->
953 <xsl:when
954 test="$taxon/name/rank/uuid='af5f2481-3192-403f-ae65-7c957a0f02b6'">
955 <xsl:value-of select="concat('{{EDIT_Family_Name|', $name, '}}')" />
956 </xsl:when>
957 <!-- genus -->
958 <xsl:when
959 test="$taxon/name/rank/uuid='1b11c34c-48a8-4efa-98d5-84f7f66ef43a'">
960 <xsl:value-of select="concat('{{EDIT_Genus Name|', $name, '}}')" />
961 </xsl:when>
962 <!--TODO -->
963 <!-- subgenus -->
964 <xsl:when
965 test="$taxon/name/rank/uuid='78786e16-2a70-48af-a608-494023b91904'">
966 <xsl:value-of select="concat('{{EDIT_Subgenus Name|', $name, '}}')" />
967 </xsl:when>
968 <!-- species -->
969 <xsl:when
970 test="$taxon/name/rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d'">
971 <xsl:value-of select="concat('{{EDIT_Species Name|', $name, '}}')" />
972 </xsl:when>
973 <xsl:otherwise>
974 <!-- for debugging -->
975 Unformatted title for rank uuid:
976 <xsl:value-of select="$taxon/name/rank/uuid" />
977 :
978 <xsl:value-of select="$taxon/name/titleCache" />
979 </xsl:otherwise>
980 </xsl:choose>
981 </xsl:template>
982
983
984 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
985
986 <!--we replace "escaped" html <i> and <b> with mediawiki markup -->
987 <!--............................................. -->
988
989 <xsl:template name="replace-tags">
990 <xsl:param name="text-string" />
991
992 <!-- first replace bold tags and put the result in text-string2 -->
993 <xsl:variable name="text-string2">
994 <xsl:call-template name="add-markup">
995 <xsl:with-param name="str" select="$text-string" />
996 <xsl:with-param name="wiki-markup">
997 '''
998 </xsl:with-param>
999 <xsl:with-param name="tag-name">
1000 b
1001 </xsl:with-param>
1002 </xsl:call-template>
1003 </xsl:variable>
1004
1005 <!-- second replace italic tags on text-string2 -->
1006 <xsl:call-template name="add-markup">
1007 <xsl:with-param name="str" select="$text-string2" />
1008 <xsl:with-param name="wiki-markup">
1009 ''
1010 </xsl:with-param>
1011 <xsl:with-param name="tag-name">
1012 i
1013 </xsl:with-param>
1014 </xsl:call-template>
1015 </xsl:template>
1016
1017 <!--............................................. -->
1018
1019 <xsl:template name="add-markup">
1020 <xsl:param name="str" />
1021 <xsl:param name="wiki-markup" />
1022 <xsl:param name="tag-name" />
1023
1024 <xsl:variable name="opening-tag">
1025 <xsl:value-of select="concat('&lt;', $tag-name, '&gt;')">
1026 </xsl:value-of>
1027 </xsl:variable>
1028 <xsl:variable name="closing-tag">
1029 <xsl:value-of select="concat('&lt;/', $tag-name, '&gt;')">
1030 </xsl:value-of>
1031 </xsl:variable>
1032
1033 <xsl:choose>
1034 <!-- if the tag occures in the string -->
1035 <xsl:when
1036 test="contains($str, $opening-tag) and contains($str, $closing-tag)">
1037
1038 <!-- separate string before, inside and after the tag -->
1039 <xsl:variable name="before-tag"
1040 select="substring-before($str, $opening-tag)" />
1041 <xsl:variable name="inside-tag"
1042 select="substring-before(substring-after($str,$opening-tag),$closing-tag)" />
1043 <xsl:variable name="after-tag"
1044 select="substring-after($str, $closing-tag)" />
1045
1046 <!-- built the new string by putting in the mediawiki template -->
1047 <xsl:value-of
1048 select="concat($before-tag, $wiki-markup, $inside-tag, $wiki-markup)" />
1049 <!-- in the part after the closing tag could be more tag, so we do a
1050 recursive call -->
1051 <xsl:call-template name="add-markup">
1052 <xsl:with-param name="str" select="$after-tag" />
1053 <xsl:with-param name="wiki-markup" select="$wiki-markup" />
1054 <xsl:with-param name="tag-name" select="$tag-name" />
1055 </xsl:call-template>
1056 </xsl:when>
1057 <xsl:otherwise>
1058 <xsl:value-of select="$str" />
1059 </xsl:otherwise>
1060 </xsl:choose>
1061 </xsl:template>
1062
1063 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
1064
1065
1066
1067
1068 </xsl:stylesheet>