merge trunk into cdm-3.3
[cdmlib.git] / cdmlib-print / src / main / resources / stylesheets / mediawiki / multipages.xsl
1
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
3 <xsl:output method="xml" indent="yes"/>
4 <!-- Authors: Sybille & Lorna -->
5 <!-- Date: March/April 2013 -->
6
7 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
8
9 <!-- create a timestamp for the whole going -->
10 <xsl:variable name="timestamp">
11 <xsl:value-of
12 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')"
13 />
14 </xsl:variable>
15
16 <!-- create the username who changed/created the pages -->
17 <xsl:variable name="username">Sybille Test </xsl:variable>
18
19 <!-- this is the start template
20 it creates the mediawiki tag surounding and calls a template to create a page for
21 every taxon node TODO: and a category -->
22 <xsl:template match="root">
23 <mediawiki xmlns="http://www.mediawiki.org/xml/export-0.7/"
24 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
25 xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.7.xsd" version="0.7"
26 xml:lang="en">
27 <siteinfo>
28 <sitename>TestWiki</sitename>
29 <base>http://biowikifarm.net/test/Main_Page</base>
30 <generator>MediaWiki 1.20.3</generator>
31 <case>first-letter</case>
32 <namespaces>
33 <namespace key="-2" case="first-letter">Media</namespace>
34 <namespace key="-1" case="first-letter">Special</namespace>
35 <namespace key="0" case="first-letter"/>
36 <namespace key="1" case="first-letter">Talk</namespace>
37 <namespace key="2" case="first-letter">User</namespace>
38 <namespace key="3" case="first-letter">User talk</namespace>
39 <namespace key="4" case="first-letter">TestWiki</namespace>
40 <namespace key="5" case="first-letter">TestWiki talk</namespace>
41 <namespace key="6" case="first-letter">File</namespace>
42 <namespace key="7" case="first-letter">File talk</namespace>
43 <namespace key="8" case="first-letter">MediaWiki</namespace>
44 <namespace key="9" case="first-letter">MediaWiki talk</namespace>
45 <namespace key="10" case="first-letter">Template</namespace>
46 <namespace key="11" case="first-letter">Template talk</namespace>
47 <namespace key="12" case="first-letter">Help</namespace>
48 <namespace key="13" case="first-letter">Help talk</namespace>
49 <namespace key="14" case="first-letter">Category</namespace>
50 <namespace key="15" case="first-letter">Category talk</namespace>
51 <namespace key="102" case="first-letter">Property</namespace>
52 <namespace key="103" case="first-letter">Property talk</namespace>
53 <namespace key="106" case="first-letter">Form</namespace>
54 <namespace key="107" case="first-letter">Form talk</namespace>
55 <namespace key="108" case="first-letter">Concept</namespace>
56 <namespace key="109" case="first-letter">Concept talk</namespace>
57 <namespace key="170" case="first-letter">Filter</namespace>
58 <namespace key="171" case="first-letter">Filter talk</namespace>
59 <namespace key="198" case="first-letter">Internal</namespace>
60 <namespace key="199" case="first-letter">Internal talk</namespace>
61 <namespace key="200" case="first-letter">Portal</namespace>
62 <namespace key="201" case="first-letter">Portal talk</namespace>
63 <namespace key="202" case="first-letter">Bibliography</namespace>
64 <namespace key="203" case="first-letter">Bibliography talk</namespace>
65 <namespace key="204" case="first-letter">Draft</namespace>
66 <namespace key="205" case="first-letter">Draft talk</namespace>
67 <namespace key="206" case="first-letter">Submission</namespace>
68 <namespace key="207" case="first-letter">Submission talk</namespace>
69 <namespace key="208" case="first-letter">Reviewed</namespace>
70 <namespace key="209" case="first-letter">Reviewed talk</namespace>
71 <namespace key="420" case="first-letter">Layer</namespace>
72 <namespace key="421" case="first-letter">Layer talk</namespace>
73 </namespaces>
74 </siteinfo>
75
76 <xsl:apply-templates select="//TaxonNode"/>
77 <!-- TODO we cannot just call every node, we have to parse the tree
78 to gather tree structure for the categories tree-->
79 </mediawiki>
80 </xsl:template>
81
82 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
83
84 <!-- this creates a page and a category for
85 every taxon node. -->
86 <!-- TODO create a template for page creating and for categorie creating -->
87 <xsl:template match="TaxonNode" name="TaxonNode">
88
89 <!-- as we will need the title more than once, we create a variable-->
90 <xsl:variable name="title">
91 <xsl:call-template name="title">
92 <xsl:with-param name="taxon" select="Taxon"/>
93 </xsl:call-template>
94 </xsl:variable>
95
96 <!-- we also initialize the parent taxon variable if there is a higher taxon assigned: -->
97
98 <xsl:variable name="parent-title">
99 <xsl:if test="exists(../..) and name(../..)='TaxonNode'">
100
101 <xsl:call-template name="title">
102 <xsl:with-param name="taxon" select="../../Taxon"/>
103 </xsl:call-template>
104
105 </xsl:if>
106 <!-- else if no higher taxon could be found -->
107 <xsl:if test="not(exists(../..)) or not(name(../..)='TaxonNode')">
108
109 <xsl:text>{{No Parent}}</xsl:text>
110
111 </xsl:if>
112 </xsl:variable>
113
114 <!-- create category -->
115 <page>
116 <title>
117 <xsl:text>Category:</xsl:text>
118 <xsl:value-of select="$title"/>
119 </title>
120 <revision>
121 <!-- TODO: create seconds without positions after decimal point! -->
122 <timestamp>
123 <xsl:value-of select="$timestamp"/>
124 </timestamp>
125 <contributor>
126 <username>Sybille Test</username>
127 </contributor>
128 <text xml:space="preserve">
129
130 <!-- redirekt to corresponding page -->
131 <xsl:value-of select="concat('#REDIRECT [[',$title,']]')"/>
132
133 <!-- add parent categorie if exists -->
134 <xsl:if test="exists(../..) and name(../..)='TaxonNode'">
135 <xsl:value-of select="concat('[[Category:',$parent-title,']]')"/>
136 </xsl:if>
137
138 </text>
139 </revision>
140 </page>
141
142 <!-- create taxon page -->
143 <page>
144 <title>
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="$username"/>
155 </username>
156 </contributor>
157 <text xml:space="preserve">
158 <!-- add table of contents -->
159 <xsl:call-template name="TOC"/>
160 <!-- add taxo tree -->
161 <xsl:value-of select="concat('{{Taxo Tree|',$parent-title, '}}')"/>
162
163 <!-- add contents of taxon page -->
164
165 <xsl:apply-templates select="Taxon"/>
166 <xsl:call-template name="display-references"/>
167
168 <!-- put page to corresponding tax category -->
169 <xsl:value-of select="concat('[[Category:',$title, ']]')"/>
170
171 </text>
172 </revision>
173 </page>
174
175 <!--<xsl:apply-templates select="//childNodes/TaxonNode/Taxon"/>-->
176 </xsl:template>
177
178 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
179
180 <!-- this template provides the correct name of a taxon
181 parameter: taxon the taxon we want to get the name from-->
182 <xsl:template name="title">
183 <xsl:param name="taxon"/>
184 <xsl:choose>
185 <!-- family -->
186 <xsl:when test="$taxon/name/rank/uuid='af5f2481-3192-403f-ae65-7c957a0f02b6'">
187 <xsl:call-template name="get-family-or-genus-title">
188 <xsl:with-param name="genusOrUninomial" select="$taxon/name/genusOrUninomial"/>
189 </xsl:call-template>
190 </xsl:when>
191 <!-- genus -->
192 <xsl:when test="$taxon/name/rank/uuid='1b11c34c-48a8-4efa-98d5-84f7f66ef43a'">
193 <xsl:call-template name="get-family-or-genus-title">
194 <xsl:with-param name="genusOrUninomial" select="$taxon/name/genusOrUninomial"/>
195 </xsl:call-template>
196 </xsl:when>
197 <!--TODO-->
198 <!-- subgenus -->
199 <xsl:when test="$taxon/name/rank/uuid='78786e16-2a70-48af-a608-494023b91904'">
200 <xsl:apply-templates select="$taxon/name/rank/representation_L10n"/>
201 <xsl:text> </xsl:text>
202 <xsl:apply-templates select="$taxon/name/genusOrUninomial"/>
203 </xsl:when>
204 <!-- species -->
205 <xsl:when test="$taxon/name/rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d'">
206 <xsl:call-template name="get-species-title">
207 <xsl:with-param name="taxon" select="$taxon"/>
208 </xsl:call-template>
209 </xsl:when>
210 <xsl:otherwise>
211 <!-- for debugging --> Unformatted title for rank uuid: <xsl:value-of
212 select="$taxon/name/rank/uuid"/>: <xsl:value-of select="$taxon/name/titleCache"
213 />
214 </xsl:otherwise>
215 </xsl:choose>
216 </xsl:template>
217
218 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
219
220 <!-- these templates create the name of the taxa wheater their kind is -->
221
222 <xsl:template name="get-family-or-genus-title">
223 <xsl:param name="genusOrUninomial"/>
224 <xsl:value-of select="$genusOrUninomial"/>
225 </xsl:template>
226
227 <xsl:template name="get-species-title">
228 <xsl:param name="taxon"/>
229 <xsl:value-of
230 select="concat($taxon/name/genusOrUninomial, ' ', $taxon/name/specificEpithet)"/>
231 </xsl:template>
232
233 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
234
235
236
237
238 <!-- we run this for the content of the page -->
239 <xsl:template match="Taxon" name="Taxon">
240 <xsl:apply-templates select="synonymy"/>
241 <xsl:apply-templates select="descriptions"/>
242 <xsl:call-template name="gallery"/>
243
244
245 </xsl:template>
246
247 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
248
249 <!-- these templates provide the citations -->
250
251 <xsl:template name="display-references">
252 <xsl:call-template name="chapter">
253 <xsl:with-param name="title">References</xsl:with-param>
254 </xsl:call-template>
255 <xsl:text>{{Show_References}}</xsl:text>
256 </xsl:template>
257
258
259 <xsl:template name="citations">
260 <xsl:param name="name-uuid"/>
261 <xsl:param name="descriptionelements" />
262
263 <!--only calling this for ag salcifolia what about the other uuids???-->
264 <xsl:value-of select="concat('{{ViBRANT_Reference|Name=',$name-uuid,'|Content=')"></xsl:value-of>
265 <!--<ref name="{$name-uuid}">-->
266 <!-- iterate through all the description elements fo the citation feature -->
267 <xsl:for-each select="$descriptionelements/descriptionelement">
268 <!-- TODO sorting only works for the first citation, implement correctly -->
269 <xsl:sort select="sources/e[1]/citation/datePublished/start"/>
270
271 <xsl:for-each select="sources/e">
272 <xsl:if test="nameUsedInSource/uuid=$name-uuid">
273 <!--xsl:text>; </xsl:text-->
274 <xsl:text>{{aut|</xsl:text>
275 <!--xsl:value-of select="citation/authorTeam/titleCache"/-->
276 <xsl:for-each select="citation/authorTeam/teamMembers/e">
277 <xsl:value-of select="lastname"/>
278 <xsl:choose>
279 <xsl:when test="position() != last()"><xsl:text> &amp; </xsl:text></xsl:when>
280 </xsl:choose>
281 </xsl:for-each>
282 <xsl:text>}} </xsl:text>
283 <xsl:value-of select="citation/datePublished/start"/>
284 <xsl:text>: </xsl:text>
285 <xsl:value-of select="citation/title"/>
286 <!--xsl:value-of select="citation/authorTeam/lastname"/>
287 <xsl:text> (</xsl:text>
288 <xsl:value-of select="citation/datePublished/start"/>
289 <xsl:text>: </xsl:text>
290 <xsl:value-of select="citationMicroReference"/>
291 <xsl:text>)</xsl:text-->
292 </xsl:if>
293 </xsl:for-each>
294
295 </xsl:for-each>
296 <!--</ref>-->
297 <xsl:text>}}</xsl:text>
298 </xsl:template>
299 <!--ref name="SC078">{{aut|Mohrig, W.; Menzel, F.}} 1992: Neue Arten europäischer Trauermücken (Diptera, Sciaridae). ''An International Journal of Dipterological Research'', '''3'''(1-2), 1–16.</ref-->
300
301 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
302
303 <!-- these templates provide the synonomy -->
304
305 <xsl:template match="synonymy" name="synonymy">
306 <!--<xsl:text>&#xA;'''Synonymy'''&#xA;&#xA;</xsl:text>-->
307 <xsl:call-template name="chapter">
308 <xsl:with-param name="title">Synonomy</xsl:with-param>
309 </xsl:call-template>
310 <xsl:apply-templates select="../name"/>
311 <xsl:apply-templates select="homotypicSynonymsByHomotypicGroup"/>
312 <xsl:apply-templates select="heterotypicSynonymyGroups"/>
313 <xsl:call-template name="citations">
314 <xsl:with-param name="descriptionelements" select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements"/>
315 <xsl:with-param name="name-uuid" select="../name/uuid"/>
316 </xsl:call-template>
317 </xsl:template>
318
319 <!--.............................................-->
320
321 <xsl:template match="homotypicSynonymsByHomotypicGroup">
322 <xsl:for-each select="e">
323 <xsl:text>{{Homotypic Synonym|1|</xsl:text>
324
325 <xsl:apply-templates select="name"/>
326 <xsl:text>}}</xsl:text>
327 </xsl:for-each>
328 </xsl:template>
329
330 <!--.............................................-->
331
332 <xsl:template match="heterotypicSynonymyGroups">
333 <xsl:for-each select="e">
334
335 <!--do foreach for the rest-->
336 <!--<xsl:text>==***==</xsl:text>-->
337 <xsl:variable name="first-element" select="e[1]"/>
338 <xsl:text>{{Heterotypic Synonym|1|</xsl:text>
339 <xsl:apply-templates select="$first-element/name"/>
340 <xsl:text>}}</xsl:text>
341 <!--<xsl:text>==***==</xsl:text>-->
342
343 <!-- take the first one to printout as the head of the homotypic group -->
344
345 <xsl:for-each select="e[position() &gt; 1]">
346 <xsl:text>{{Homotypic Synonym|2|</xsl:text>
347 <xsl:apply-templates select="name"/>
348 <xsl:text>}}</xsl:text>
349 <!--xsl:call-template name="citations">
350 <LORNA Pass the description elements for the citation 99b2842f-9aa7-42fa-bd5f-7285311e0101>
351 <xsl:with-param name="descriptionelements" select="../../../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements"/>
352 <xsl:with-param name="name-uuid" select="name/uuid"/>
353 </xsl:call-template-->
354 </xsl:for-each>
355 </xsl:for-each>
356
357 <!--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-->
358 </xsl:template>
359
360 <!--.............................................-->
361
362 <xsl:template match="name">
363 <xsl:apply-templates select="taggedName"/>
364 <!--xsl:apply-templates select="nomenclaturalReference"/-->
365 </xsl:template>
366
367 <xsl:template match="taggedName">
368 <xsl:for-each select="e">
369 <!-- TODO mybe some types don't contain font tags, we don't have to call the tmeplate -->
370 <!-- we could just use <xsl:value-of select="text"/>-->
371 <xsl:choose>
372 <xsl:when test="type='name'">
373 <xsl:apply-templates select="text"/>
374 <xsl:text> </xsl:text>
375 </xsl:when>
376 <xsl:when test="type='authors'">
377 <xsl:apply-templates select="text"/>
378 </xsl:when>
379 <xsl:otherwise>
380 <xsl:apply-templates select="text"/>
381 <xsl:text> </xsl:text>
382 </xsl:otherwise>
383 </xsl:choose>
384 </xsl:for-each>
385 <xsl:text>&#xA;</xsl:text>
386 </xsl:template>
387
388 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
389
390 <!-- description features -->
391
392 <!-- TODO: for first and second level:
393 check if there is a page that describes the feature
394 and use Parameter "Link=pagename" with templates Tax_Feature or
395 Second_Level_Feature-->
396
397 <xsl:template match="descriptions" name="descriptions">
398 <xsl:for-each select="features/feature">
399 <xsl:choose>
400 <xsl:when test="count(feature)!=0">
401 <xsl:call-template name="secondLevelDescriptionElements"/>
402 </xsl:when>
403 <xsl:otherwise>
404 <!-- everything but Citation -->
405 <xsl:if test="uuid!='99b2842f-9aa7-42fa-bd5f-7285311e0101'">
406 <xsl:call-template name="descriptionElements"/>
407 </xsl:if>
408 <!--xsl:apply-templates select="media/e/representations/e/parts/e/uri"/-->
409 </xsl:otherwise>
410 </xsl:choose>
411 </xsl:for-each>
412 </xsl:template>
413
414 <!--.............................................-->
415
416 <xsl:template name="secondLevelDescriptionElements">
417
418 <xsl:value-of select="concat('{{Two_Leveled_Features_Title|',representation_L10n,'}}')"/>
419
420 <xsl:for-each select="feature">
421 <xsl:value-of
422 select="concat('{{Second_Level_Feature|Name=',representation_L10n,'|Elements=')"/>
423 <!-- TODO create Element -->
424 <xsl:for-each select="descriptionelements/descriptionelement">
425 <xsl:value-of
426 select="concat('{{Second_Level_Feature_DescrElement|',multilanguageText_L10n/text, '}}')"
427 />
428 </xsl:for-each>
429 <xsl:text>}}</xsl:text>
430 </xsl:for-each>
431
432 </xsl:template>
433 <!--.............................................-->
434
435
436 <xsl:template name="descriptionElements">
437 <xsl:choose>
438 <xsl:when test="supportsCommonTaxonName='true'">
439 <!-- must be Vernacular Name feature -->
440 <xsl:call-template name="commonTaxonName"/>
441 </xsl:when>
442 <xsl:otherwise>
443 <!-- for example Habitat, Material Examined -->
444 <xsl:call-template name="textData"/>
445 </xsl:otherwise>
446 </xsl:choose>
447 </xsl:template>
448
449 <!--.............................................-->
450
451 <xsl:template name="commonTaxonName">
452
453 <xsl:value-of select="concat('{{Tax_Feature|Name=',representation_L10n,'|Elements=')"/>
454 <xsl:for-each select="descriptionelements/descriptionelement">
455 <xsl:text/>
456 <xsl:value-of
457 select="concat('{{Common_Name_Feature_Element|Name=',name,'|Language=',language/representation_L10n,'}}')"
458 />
459 </xsl:for-each>
460 <xsl:text>}}</xsl:text>
461 </xsl:template>
462
463 <!--.............................................-->
464
465 <xsl:template name="textData">
466
467 <xsl:value-of
468 select="concat('{{Tax_Feature|Name=',representation_L10n, '|Elements={{Feature_Text|' )"/>
469 <xsl:choose>
470 <xsl:when test="uuid!='9fc9d10c-ba50-49ee-b174-ce83fc3f80c6'">
471 <!-- feature is not "Distribution" -->
472 <xsl:apply-templates
473 select="descriptionelements/descriptionelement[1]/multilanguageText_L10n/text"/>
474 </xsl:when>
475 </xsl:choose>
476
477 <xsl:text>}}}}</xsl:text>
478
479
480 <!-- LORNA TRY IMAGE HERE -->
481 <!--xsl:apply-templates select="descriptionelements/descriptionelement[1]/media/e/representations/e/parts/e/uri"/-->
482
483
484 </xsl:template>
485
486 <!--.............................................-->
487
488
489 <xsl:template match="text">
490
491 <xsl:choose>
492 <xsl:when test="contains(.,&quot;&lt;b&gt;&quot;)">
493 <xsl:call-template name="add-markup">
494 <xsl:with-param name="str" select="."/>
495 <!--xsl:with-param name="tag-name" select="b"/-->
496 <xsl:with-param name="tag-name">b</xsl:with-param>
497 </xsl:call-template>
498 </xsl:when>
499 <xsl:otherwise>
500 <xsl:call-template name="add-markup">
501 <xsl:with-param name="str" select="."/>
502 <xsl:with-param name="tag-name">i</xsl:with-param>
503 </xsl:call-template>
504 </xsl:otherwise>
505 </xsl:choose>
506
507 <!--/fo:block -->
508 </xsl:template>
509
510 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
511 <!-- image gallery -->
512
513 <xsl:template name="gallery">
514 <!--<xsl:text>{{ViBRANT_Gallery|Files=</xsl:text>--> {{chapter|Images}} <xsl:value-of
515 select="concat('===',./name/titleCache,'===')"/>
516 <xsl:apply-templates select="//media/e/representations/e/parts/e/uri"/>
517 <!--<xsl:text>}}</xsl:text>-->
518 </xsl:template>
519
520 <xsl:template match="uri">
521 <xsl:text>FOO</xsl:text>
522 <xsl:value-of select="."/>
523 <!--go back up to the description element and get the text for the Figure legend -->
524 <!--<xsl:apply-templates select="../../../../../../../multilanguageText_L10n/text"/>-->
525
526 </xsl:template>
527
528 <!--+++++++++++++++++++++++++++++L A Y O U T ++++++++++++++++++++++++++++++++++++++ -->
529
530
531 <!-- change here to change the look of the mediawiki output -->
532 <!-- please use mediawiki templates -->
533 <!-- think also of template changes in the mediawiki -->
534 <!-- TODO: wrap TOC layout in a mediawiki template -->
535
536 <xsl:template name="TOC"> {{ViBRANT_TOC}} </xsl:template>
537
538 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
539
540 <xsl:template name="chapter">
541 <xsl:param name="title"/>
542 <xsl:value-of select="concat('{{Chapter|',$title,'}}')"/>
543 </xsl:template>
544
545 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
546
547 <xsl:template name="subchapter">
548 <xsl:param name="title"/>
549 <xsl:value-of select="concat('{{Subchapter|',$title,'}}')"/>
550 </xsl:template>
551
552 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
553
554 <!--this template layouts and displays the name of a
555 taxon depending on it's "kind"
556 MAYDO: create more useful layouts instead of title sizes-->
557 <xsl:template name="display-taxon-name">
558 <xsl:param name="taxon"/>
559 <!-- get the name of the taxon -->
560 <xsl:variable name="name">
561 <xsl:call-template name="title">
562 <xsl:with-param name="taxon" select="$taxon"/>
563 </xsl:call-template>
564 </xsl:variable>
565 <!-- format the name of the taxon according to it's kind -->
566 <xsl:choose>
567 <!-- family -->
568 <xsl:when test="$taxon/name/rank/uuid='af5f2481-3192-403f-ae65-7c957a0f02b6'">
569 <xsl:value-of select="concat('{{Family name|', $name, '}}')"/>
570 </xsl:when>
571 <!-- genus -->
572 <xsl:when test="$taxon/name/rank/uuid='1b11c34c-48a8-4efa-98d5-84f7f66ef43a'">
573 <xsl:value-of select="concat('{{Genus name|', $name, '}}')"/>
574 </xsl:when>
575 <!--TODO-->
576 <!-- subgenus -->
577 <xsl:when test="$taxon/name/rank/uuid='78786e16-2a70-48af-a608-494023b91904'">
578 <xsl:value-of select="concat('{{Subgenus name|', $name, '}}')"/>
579 </xsl:when>
580 <!-- species -->
581 <xsl:when test="$taxon/name/rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d'">
582 <xsl:value-of select="concat('{{Species name|', $name, '}}')"/>
583 </xsl:when>
584 <xsl:otherwise>
585 <!-- for debugging --> Unformatted title for rank uuid: <xsl:value-of
586 select="$taxon/name/rank/uuid"/>: <xsl:value-of select="$taxon/name/titleCache"
587 />
588 </xsl:otherwise>
589 </xsl:choose>
590 </xsl:template>
591
592
593 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
594
595 <!--we replace html i> with mediawiki templates-->
596 <xsl:template match="text" name="replace_html_tags">
597 <xsl:call-template name="replace-tags">
598 <xsl:with-param name="text-string" select="."/>
599 </xsl:call-template>
600
601 </xsl:template>
602
603 <!--.............................................-->
604
605 <xsl:template name="replace-tags">
606 <xsl:param name="text-string"/>
607 <xsl:choose>
608 <xsl:when test="contains($text-string,';&lt;b&gt;')">
609 <xsl:call-template name="add-markup">
610 <xsl:with-param name="str" select="$text-string"/>
611 <!--xsl:with-param name="tag-name" select="b"/-->
612 <xsl:with-param name="wiki-template">Bold</xsl:with-param>
613 <xsl:with-param name="tag-name">b</xsl:with-param>
614 </xsl:call-template>
615 </xsl:when>
616 <xsl:otherwise>
617 <xsl:call-template name="add-markup">
618 <xsl:with-param name="str" select="$text-string"/>
619 <xsl:with-param name="wiki-template">Italic</xsl:with-param>
620 <xsl:with-param name="tag-name">i</xsl:with-param>
621 </xsl:call-template>
622 </xsl:otherwise>
623 </xsl:choose>
624
625 </xsl:template>
626
627 <!--.............................................-->
628
629 <xsl:template name="add-markup">
630 <xsl:param name="str"/>
631 <xsl:param name="wiki-template"/>
632 <xsl:param name="tag-name"/>
633
634 <xsl:variable name="opening-tag">
635 <xsl:value-of select="concat('&lt;', $tag-name, '&gt;')"> </xsl:value-of>
636 </xsl:variable>
637 <xsl:variable name="closing-tag">
638 <xsl:value-of select="concat('&lt;/', $tag-name, '&gt;')"> </xsl:value-of>
639 </xsl:variable>
640
641
642 <xsl:choose>
643 <xsl:when test="contains($str, $opening-tag) and contains($str, $closing-tag)">
644 <xsl:variable name="before-tag" select="substring-before($str, $opening-tag)"/>
645 <xsl:variable name="inside-tag"
646 select="substring-before(substring-after($str,$opening-tag),$closing-tag)"/>
647 <xsl:variable name="after-tag" select="substring-after($str, $closing-tag)"/>
648 <xsl:value-of select="concat($before-tag,'{{',$wiki-template,'|',$inside-tag,'}}')"/>
649 <xsl:call-template name="replace-tags">
650 <xsl:with-param name="text-string" select="$after-tag"/>
651 </xsl:call-template>
652 </xsl:when>
653 <xsl:otherwise>
654 <xsl:value-of select="$str"/>
655 </xsl:otherwise>
656 </xsl:choose>
657 </xsl:template>
658
659 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
660
661 </xsl:stylesheet>