merge hibernate4 into trunk (2nd step)
[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
243
244 </xsl:template>
245
246 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
247
248 <!-- these templates provide the citations -->
249
250 <xsl:template name="display-references">
251 <xsl:call-template name="chapter">
252 <xsl:with-param name="title">References</xsl:with-param>
253 </xsl:call-template>
254 <references/>
255 </xsl:template>
256
257
258 <xsl:template name="citations">
259 <xsl:param name="name-uuid"/>
260 <xsl:param name="descriptionelements" />
261
262 <!--only calling this for ag salcifolia what about the other uuids???-->
263 <ref name="{$name-uuid}">
264 <!-- iterate through all the description elements fo the citation feature -->
265 <xsl:for-each select="$descriptionelements/descriptionelement">
266 <!-- TODO sorting only works for the first citation, implement correctly -->
267 <xsl:sort select="sources/e[1]/citation/datePublished/start"/>
268
269 <xsl:for-each select="sources/e">
270 <xsl:if test="nameUsedInSource/uuid=$name-uuid">
271 <!--xsl:text>; </xsl:text-->
272 <xsl:text>{{aut|</xsl:text>
273 <!--xsl:value-of select="citation/authorTeam/titleCache"/-->
274 <xsl:for-each select="citation/authorTeam/teamMembers/e">
275 <xsl:value-of select="lastname"/>
276 <xsl:choose>
277 <xsl:when test="position() != last()"><xsl:text> &amp; </xsl:text></xsl:when>
278 </xsl:choose>
279 </xsl:for-each>
280 <xsl:text>}} </xsl:text>
281 <xsl:value-of select="citation/datePublished/start"/>
282 <xsl:text>: </xsl:text>
283 <xsl:value-of select="citation/title"/>
284 <!--xsl:value-of select="citation/authorTeam/lastname"/>
285 <xsl:text> (</xsl:text>
286 <xsl:value-of select="citation/datePublished/start"/>
287 <xsl:text>: </xsl:text>
288 <xsl:value-of select="citationMicroReference"/>
289 <xsl:text>)</xsl:text-->
290 </xsl:if>
291 </xsl:for-each>
292
293 </xsl:for-each>
294 </ref>
295 </xsl:template>
296 <!--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-->
297
298 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
299
300 <!-- these templates provide the synonomy -->
301
302 <xsl:template match="synonymy" name="synonymy">
303 <!--<xsl:text>&#xA;'''Synonymy'''&#xA;&#xA;</xsl:text>-->
304 <xsl:call-template name="chapter">
305 <xsl:with-param name="title">Synonomy</xsl:with-param>
306 </xsl:call-template>
307 <xsl:apply-templates select="../name"/>
308 <xsl:apply-templates select="homotypicSynonymsByHomotypicGroup"/>
309 <xsl:apply-templates select="heterotypicSynonymyGroups"/>
310 <xsl:call-template name="citations">
311 <xsl:with-param name="descriptionelements" select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements"/>
312 <xsl:with-param name="name-uuid" select="../name/uuid"/>
313 </xsl:call-template>
314 </xsl:template>
315
316 <!--.............................................-->
317
318 <xsl:template match="homotypicSynonymsByHomotypicGroup">
319 <xsl:for-each select="e">
320 <xsl:text>{{Homotypic Synonym|1|</xsl:text>
321
322 <xsl:apply-templates select="name"/>
323 <xsl:text>}}</xsl:text>
324 </xsl:for-each>
325 </xsl:template>
326
327 <!--.............................................-->
328
329 <xsl:template match="heterotypicSynonymyGroups">
330 <xsl:for-each select="e">
331
332 <!--do foreach for the rest-->
333 <!--<xsl:text>==***==</xsl:text>-->
334 <xsl:variable name="first-element" select="e[1]"/>
335 <xsl:text>{{Heterotypic Synonym|1|</xsl:text>
336 <xsl:apply-templates select="$first-element/name"/>
337 <xsl:text>}}</xsl:text>
338 <!--<xsl:text>==***==</xsl:text>-->
339
340 <!-- take the first one to printout as the head of the homotypic group -->
341
342 <xsl:for-each select="e[position() &gt; 1]">
343 <xsl:text>{{Homotypic Synonym|2|</xsl:text>
344 <xsl:apply-templates select="name"/>
345 <xsl:text>}}</xsl:text>
346 <!--xsl:call-template name="citations">
347 <LORNA Pass the description elements for the citation 99b2842f-9aa7-42fa-bd5f-7285311e0101>
348 <xsl:with-param name="descriptionelements" select="../../../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements"/>
349 <xsl:with-param name="name-uuid" select="name/uuid"/>
350 </xsl:call-template-->
351 </xsl:for-each>
352 </xsl:for-each>
353
354 <!--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-->
355 </xsl:template>
356
357 <!--.............................................-->
358
359 <xsl:template match="name">
360 <xsl:apply-templates select="taggedName"/>
361 <!--xsl:apply-templates select="nomenclaturalReference"/-->
362 </xsl:template>
363
364 <xsl:template match="taggedName">
365 <xsl:for-each select="e">
366 <!-- TODO mybe some types don't contain font tags, we don't have to call the tmeplate -->
367 <!-- we could just use <xsl:value-of select="text"/>-->
368 <xsl:choose>
369 <xsl:when test="type='name'">
370 <xsl:apply-templates select="text"/>
371 <xsl:text> </xsl:text>
372 </xsl:when>
373 <xsl:when test="type='authors'">
374 <xsl:apply-templates select="text"/>
375 </xsl:when>
376 <xsl:otherwise>
377 <xsl:apply-templates select="text"/>
378 <xsl:text> </xsl:text>
379 </xsl:otherwise>
380 </xsl:choose>
381 </xsl:for-each>
382 <xsl:text>&#xA;</xsl:text>
383 </xsl:template>
384
385 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
386
387 <!-- description features -->
388
389 <xsl:template match="descriptions" name="descriptions">
390 <xsl:for-each select="features/feature">
391 <xsl:choose>
392 <xsl:when test="count(feature)!=0">
393 <xsl:call-template name="secondLevelDescriptionElements"/>
394 </xsl:when>
395 <xsl:otherwise>
396 <!-- everything but Citation -->
397 <xsl:if test="uuid!='99b2842f-9aa7-42fa-bd5f-7285311e0101'">
398 <xsl:call-template name="descriptionElements"/>
399 </xsl:if>
400 <!--xsl:apply-templates select="media/e/representations/e/parts/e/uri"/-->
401 </xsl:otherwise>
402 </xsl:choose>
403 </xsl:for-each>
404 </xsl:template>
405
406 <!--.............................................-->
407
408 <xsl:template name="secondLevelDescriptionElements">
409
410 <xsl:value-of select="concat('{{Two_Leveled_Features_Title|',representation_L10n,'}}')"></xsl:value-of>
411
412 <xsl:for-each select="feature">
413 <xsl:value-of select="concat('{{Second_Level_Feature|Name=',representation_L10n,'|Elements=')"></xsl:value-of>
414 <!-- TODO create Element -->
415 <xsl:for-each select="descriptionelements/descriptionelement">
416 <xsl:value-of select="concat('{{Second_Level_Feature_DescrElement|',multilanguageText_L10n/text, '}}')"></xsl:value-of>
417 </xsl:for-each>
418 <xsl:text>}}</xsl:text>
419 </xsl:for-each>
420
421 </xsl:template>
422 <!--.............................................-->
423
424
425 <xsl:template name="descriptionElements">
426 <xsl:choose>
427 <xsl:when test="supportsCommonTaxonName='true'">
428 <!-- must be Vernacular Name feature -->
429 <xsl:call-template name="commonTaxonName"/>
430 </xsl:when>
431 <xsl:otherwise>
432 <!-- for example Habitat, Material Examined -->
433 <xsl:call-template name="textData"/>
434 </xsl:otherwise>
435 </xsl:choose>
436 </xsl:template>
437
438 <!--.............................................-->
439
440 <xsl:template name="commonTaxonName">
441
442 <xsl:value-of select="concat('{{Tax_Feature|Name=',representation_L10n,'|Elements=')"/>
443 <xsl:for-each select="descriptionelements/descriptionelement">
444 <xsl:text/>
445 <xsl:value-of
446 select="concat('{{Common_Name_Feature_Element|Name=',name,'|Language=',language/representation_L10n,'}}')"
447 />
448 </xsl:for-each>
449 <xsl:text>}}</xsl:text>
450 </xsl:template>
451
452 <!--.............................................-->
453
454 <xsl:template name="textData">
455
456 <xsl:value-of
457 select="concat('{{Tax_Feature|Name=',representation_L10n, '|Elements={{Feature_Text|' )"/>
458 <xsl:choose>
459 <xsl:when test="uuid!='9fc9d10c-ba50-49ee-b174-ce83fc3f80c6'"> <!-- feature is not "Distribution" -->
460 <xsl:apply-templates
461 select="descriptionelements/descriptionelement[1]/multilanguageText_L10n/text"/>
462 </xsl:when>
463 </xsl:choose>
464
465 <xsl:text>}}}}</xsl:text>
466
467
468 <!-- LORNA TRY IMAGE HERE -->
469 <!--xsl:apply-templates select="descriptionelements/descriptionelement[1]/media/e/representations/e/parts/e/uri"/-->
470
471
472 </xsl:template>
473
474 <!--.............................................-->
475
476
477 <xsl:template match="text">
478
479 <xsl:choose>
480 <xsl:when test="contains(.,&quot;&lt;b&gt;&quot;)">
481 <xsl:call-template name="add-markup">
482 <xsl:with-param name="str" select="."/>
483 <!--xsl:with-param name="tag-name" select="b"/-->
484 <xsl:with-param name="tag-name">b</xsl:with-param>
485 </xsl:call-template>
486 </xsl:when>
487 <xsl:otherwise>
488 <xsl:call-template name="add-markup">
489 <xsl:with-param name="str" select="."/>
490 <xsl:with-param name="tag-name">i</xsl:with-param>
491 </xsl:call-template>
492 </xsl:otherwise>
493 </xsl:choose>
494
495 <!--/fo:block -->
496 </xsl:template>
497
498
499 <!--+++++++++++++++++++++++++++++L A Y O U T ++++++++++++++++++++++++++++++++++++++ -->
500
501
502 <!-- change here to change the look of the mediawiki output -->
503 <!-- please use mediawiki templates -->
504 <!-- think also of template changes in the mediawiki -->
505 <!-- TODO: wrap TOC layout in a mediawiki template -->
506
507 <xsl:template name="TOC"> {{ViBRANT_TOC}} </xsl:template>
508
509 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
510
511 <xsl:template name="chapter">
512 <xsl:param name="title"/>
513 <xsl:value-of select="concat('{{Chapter|',$title,'}}')"/>
514 </xsl:template>
515
516 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
517
518 <xsl:template name="subchapter">
519 <xsl:param name="title"/>
520 <xsl:value-of select="concat('{{Subchapter|',$title,'}}')"/>
521 </xsl:template>
522
523 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
524
525 <!--this template layouts and displays the name of a
526 taxon depending on it's "kind"
527 MAYDO: create more useful layouts instead of title sizes-->
528 <xsl:template name="display-taxon-name">
529 <xsl:param name="taxon"/>
530 <!-- get the name of the taxon -->
531 <xsl:variable name="name">
532 <xsl:call-template name="title">
533 <xsl:with-param name="taxon" select="$taxon"/>
534 </xsl:call-template>
535 </xsl:variable>
536 <!-- format the name of the taxon according to it's kind -->
537 <xsl:choose>
538 <!-- family -->
539 <xsl:when test="$taxon/name/rank/uuid='af5f2481-3192-403f-ae65-7c957a0f02b6'">
540 <xsl:value-of select="concat('{{Family name|', $name, '}}')"/>
541 </xsl:when>
542 <!-- genus -->
543 <xsl:when test="$taxon/name/rank/uuid='1b11c34c-48a8-4efa-98d5-84f7f66ef43a'">
544 <xsl:value-of select="concat('{{Genus name|', $name, '}}')"/>
545 </xsl:when>
546 <!--TODO-->
547 <!-- subgenus -->
548 <xsl:when test="$taxon/name/rank/uuid='78786e16-2a70-48af-a608-494023b91904'">
549 <xsl:value-of select="concat('{{Subgenus name|', $name, '}}')"/>
550 </xsl:when>
551 <!-- species -->
552 <xsl:when test="$taxon/name/rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d'">
553 <xsl:value-of select="concat('{{Species name|', $name, '}}')"/>
554 </xsl:when>
555 <xsl:otherwise>
556 <!-- for debugging --> Unformatted title for rank uuid: <xsl:value-of
557 select="$taxon/name/rank/uuid"/>: <xsl:value-of select="$taxon/name/titleCache"
558 />
559 </xsl:otherwise>
560 </xsl:choose>
561 </xsl:template>
562
563
564 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
565
566 <!--we replace html i> with mediawiki templates-->
567 <xsl:template match="text" name="replace_html_tags">
568 <xsl:call-template name="replace-tags">
569 <xsl:with-param name="text-string" select="."/>
570 </xsl:call-template>
571
572 </xsl:template>
573
574 <!--.............................................-->
575
576 <xsl:template name="replace-tags">
577 <xsl:param name="text-string"/>
578 <xsl:choose>
579 <xsl:when test="contains($text-string,';&lt;b&gt;')">
580 <xsl:call-template name="add-markup">
581 <xsl:with-param name="str" select="$text-string"/>
582 <!--xsl:with-param name="tag-name" select="b"/-->
583 <xsl:with-param name="wiki-template">Bold</xsl:with-param>
584 <xsl:with-param name="tag-name">b</xsl:with-param>
585 </xsl:call-template>
586 </xsl:when>
587 <xsl:otherwise>
588 <xsl:call-template name="add-markup">
589 <xsl:with-param name="str" select="$text-string"/>
590 <xsl:with-param name="wiki-template">Italic</xsl:with-param>
591 <xsl:with-param name="tag-name">i</xsl:with-param>
592 </xsl:call-template>
593 </xsl:otherwise>
594 </xsl:choose>
595
596 </xsl:template>
597
598 <!--.............................................-->
599
600 <xsl:template name="add-markup">
601 <xsl:param name="str"/>
602 <xsl:param name="wiki-template"/>
603 <xsl:param name="tag-name"/>
604
605 <xsl:variable name="opening-tag">
606 <xsl:value-of select="concat('&lt;', $tag-name, '&gt;')"> </xsl:value-of>
607 </xsl:variable>
608 <xsl:variable name="closing-tag">
609 <xsl:value-of select="concat('&lt;/', $tag-name, '&gt;')"> </xsl:value-of>
610 </xsl:variable>
611
612
613 <xsl:choose>
614 <xsl:when test="contains($str, $opening-tag) and contains($str, $closing-tag)">
615 <xsl:variable name="before-tag" select="substring-before($str, $opening-tag)"/>
616 <xsl:variable name="inside-tag"
617 select="substring-before(substring-after($str,$opening-tag),$closing-tag)"/>
618 <xsl:variable name="after-tag" select="substring-after($str, $closing-tag)"/>
619 <xsl:value-of select="concat($before-tag,'{{',$wiki-template,'|',$inside-tag,'}}')"/>
620 <xsl:call-template name="replace-tags">
621 <xsl:with-param name="text-string" select="$after-tag"/>
622 </xsl:call-template>
623 </xsl:when>
624 <xsl:otherwise>
625 <xsl:value-of select="$str"/>
626 </xsl:otherwise>
627 </xsl:choose>
628 </xsl:template>
629
630 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
631
632 </xsl:stylesheet>