1 <!DOCTYPE xsl:stylesheet [<!ENTITY hyphen "-" > <!ENTITY ndash "–" >]>
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 <xsl:import href="src/main/resources/stylesheets/mediawiki/functx-1.0-doc-2007-01.xsl" />
6 <!--xsl:import href="functx-1.0-doc-2007-01.xsl" /-->
7 <!-- xsl:output method="xml" indent="no"/> -->
8 <xsl:strip-space elements="text" />
10 <!-- Authors: Sybille & Lorna -->
11 <!-- Date: March/April 2013 -->
13 <!--++++++++++ global vars (and templates used as such) +++++++++++++++++++++++++++ -->
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>
22 <!-- cdm url of source -->
23 <xsl:param name="cdm-url"></xsl:param>
24 <xsl:variable name="cdm-credit-text">
25 <xsl:value-of select="concat('This page was generated automatically from content in ', $cdm-url)"></xsl:value-of>
28 <!-- create a timestamp for the whole going -->
29 <xsl:variable name="timestamp">
31 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')" />
34 <!-- create the username who changed/created the pages -->
35 <xsl:param name="username"></xsl:param>
36 <xsl:variable name="u_name">
37 <xsl:value-of select="$username"></xsl:value-of>
40 <xsl:template name="wiki-newline">
41 <xsl:text>
</xsl:text>
44 <xsl:template name="wiki-newline-comment">
46 <xsl:text>
 </xsl:text>
50 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
52 <!-- this is the start template it creates the mediawiki tag surounding
53 and calls a template to create a page for every taxon node TODO: and a category -->
54 <xsl:template match="root">
55 <mediawiki xmlns="http://www.mediawiki.org/xml/export-0.7/"
56 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
57 xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.7.xsd"
58 version="0.7" xml:lang="en">
60 <sitename>TestWiki</sitename>
61 <base>http://biowikifarm.net/test/Main_Page</base>
62 <generator>MediaWiki 1.20.3</generator>
63 <case>first-letter</case>
65 <namespace key="-2" case="first-letter">Media</namespace>
66 <namespace key="-1" case="first-letter">Special</namespace>
67 <namespace key="0" case="first-letter" />
68 <namespace key="1" case="first-letter">Talk</namespace>
69 <namespace key="2" case="first-letter">User</namespace>
70 <namespace key="3" case="first-letter">User talk</namespace>
71 <namespace key="4" case="first-letter">TestWiki</namespace>
72 <namespace key="5" case="first-letter">TestWiki talk</namespace>
73 <namespace key="6" case="first-letter">File</namespace>
74 <namespace key="7" case="first-letter">File talk</namespace>
75 <namespace key="8" case="first-letter">MediaWiki</namespace>
76 <namespace key="9" case="first-letter">MediaWiki talk</namespace>
77 <namespace key="10" case="first-letter">Template</namespace>
78 <namespace key="11" case="first-letter">Template talk</namespace>
79 <namespace key="12" case="first-letter">Help</namespace>
80 <namespace key="13" case="first-letter">Help talk</namespace>
81 <namespace key="14" case="first-letter">Category</namespace>
82 <namespace key="15" case="first-letter">Category talk</namespace>
83 <namespace key="102" case="first-letter">Property</namespace>
84 <namespace key="103" case="first-letter">Property talk</namespace>
85 <namespace key="106" case="first-letter">Form</namespace>
86 <namespace key="107" case="first-letter">Form talk</namespace>
87 <namespace key="108" case="first-letter">Concept</namespace>
88 <namespace key="109" case="first-letter">Concept talk</namespace>
89 <namespace key="170" case="first-letter">Filter</namespace>
90 <namespace key="171" case="first-letter">Filter talk</namespace>
91 <namespace key="198" case="first-letter">Internal</namespace>
92 <namespace key="199" case="first-letter">Internal talk</namespace>
93 <namespace key="200" case="first-letter">Portal</namespace>
94 <namespace key="201" case="first-letter">Portal talk</namespace>
95 <namespace key="202" case="first-letter">Bibliography</namespace>
96 <namespace key="203" case="first-letter">Bibliography talk</namespace>
97 <namespace key="204" case="first-letter">Draft</namespace>
98 <namespace key="205" case="first-letter">Draft talk</namespace>
99 <namespace key="206" case="first-letter">Submission</namespace>
100 <namespace key="207" case="first-letter">Submission talk</namespace>
101 <namespace key="208" case="first-letter">Reviewed</namespace>
102 <namespace key="209" case="first-letter">Reviewed talk</namespace>
103 <namespace key="420" case="first-letter">Layer</namespace>
104 <namespace key="421" case="first-letter">Layer talk</namespace>
107 <xsl:apply-templates select="//TaxonNode" />
111 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
113 <!-- this creates a page and a category for every taxon node. -->
114 <!-- TODO create a template for page creating and for categorie creating -->
115 <xsl:template match="TaxonNode" name="TaxonNode">
116 <!-- as we will need the title more than once, we create a variable -->
117 <xsl:variable name="title">
118 <xsl:call-template name="title">
119 <xsl:with-param name="taxon" select="Taxon" />
123 <!-- we also initialize the parent taxon variable if there is a higher
126 <xsl:variable name="parent-title">
127 <xsl:if test="exists(../..) and name(../..)='TaxonNode'">
129 <xsl:call-template name="title">
130 <xsl:with-param name="taxon" select="../../Taxon" />
134 <!-- else if no higher taxon could be found -->
135 <xsl:if test="not(exists(../..)) or not(name(../..)='TaxonNode')">
137 <xsl:text>{{EDIT No Parent available}}</xsl:text>
142 <!-- create category -->
144 <!-- this creates a newline before the <page>
145 if it was not there, the page could not be imported by the mediawiki-->
150 <xsl:text>Category:</xsl:text>
151 <xsl:value-of select="$title" />
154 <!-- TODO: create seconds without positions after decimal point! -->
156 <xsl:value-of select="$timestamp" />
160 <xsl:value-of select="$u_name" />
165 <xsl:attribute name="xml:space">preserve</xsl:attribute>
166 <!-- redirekt to corresponding page -->
167 <xsl:value-of select="concat('#REDIRECT [[',$page-prefix,$title,']]')" />
168 <!-- add parent categorie if exists -->
169 <xsl:if test="exists(../..) and name(../..)='TaxonNode'">
170 <xsl:call-template name="wiki-newline" />
171 <xsl:value-of select="concat('[[Category:',$parent-title,']]')" />
178 <!-- create taxon page -->
181 <xsl:value-of select="concat($page-prefix,$title)" />
184 <!-- MAYDO: create seconds without positions after decimal point! -->
186 <xsl:value-of select="$timestamp" />
190 <xsl:value-of select="$username" />
195 <xsl:attribute name="xml:space">preserve</xsl:attribute>
196 <!-- add table of contents -->
197 <xsl:call-template name="TOC" />
198 <!-- add taxo tree -->
200 select="concat('{{EDIT_Taxotree| parentTaxon=',$page-prefix,$parent-title,'}}')" />
201 <xsl:call-template name="wiki-newline" />
202 <xsl:call-template name="wiki-newline" />
204 <!-- add contents of taxon page -->
205 <xsl:call-template name="credit" />
206 <xsl:call-template name="wiki-newline" />
207 <xsl:apply-templates select="Taxon" />
208 <xsl:call-template name="display-references" />
209 <xsl:call-template name="wiki-newline" />
210 <xsl:call-template name="wiki-newline" />
211 <!-- put page to corresponding tax category -->
212 <xsl:value-of select="concat('[[Category:',$title, ']]')" />
218 <!--<xsl:apply-templates select="//childNodes/TaxonNode/Taxon"/> -->
221 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
223 <!-- this template provides the correct name of a taxon parameter: taxon
224 the taxon we want to get the name from -->
225 <xsl:template name="title">
226 <xsl:param name="taxon" />
230 test="$taxon/name/rank/uuid='af5f2481-3192-403f-ae65-7c957a0f02b6'">
231 <xsl:call-template name="get-family-or-genus-title">
232 <xsl:with-param name="genusOrUninomial" select="$taxon/name/genusOrUninomial" />
237 test="$taxon/name/rank/uuid='1b11c34c-48a8-4efa-98d5-84f7f66ef43a'">
238 <xsl:call-template name="get-family-or-genus-title">
239 <xsl:with-param name="genusOrUninomial" select="$taxon/name/genusOrUninomial" />
245 test="$taxon/name/rank/uuid='78786e16-2a70-48af-a608-494023b91904'">
246 <xsl:apply-templates select="$taxon/name/rank/representation_L10n" />
247 <xsl:text> </xsl:text>
248 <xsl:apply-templates select="$taxon/name/genusOrUninomial" />
252 test="$taxon/name/rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d'">
253 <xsl:call-template name="get-species-title">
254 <xsl:with-param name="taxon" select="$taxon" />
258 <!-- for debugging -->
259 Unformatted title for rank uuid:
260 <xsl:value-of select="$taxon/name/rank/uuid" />
262 <xsl:value-of select="$taxon/name/titleCache">
268 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
270 <!-- these templates create the name of the taxa wheater their kind is -->
272 <xsl:template name="get-family-or-genus-title">
273 <xsl:param name="genusOrUninomial" />
274 <xsl:value-of select="$genusOrUninomial" />
277 <xsl:template name="get-species-title">
278 <xsl:param name="taxon" />
280 select="concat($taxon/name/genusOrUninomial, ' ', $taxon/name/specificEpithet)" />
283 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
285 <!-- we run this for the content of the page -->
286 <xsl:template match="Taxon" name="Taxon">
288 <xsl:apply-templates select="synonymy" />
289 <xsl:apply-templates select="key" />
290 <xsl:apply-templates select="descriptions" />
291 <!-- A change to Gallery: uncomment following line: -->
292 <!-- <xsl:call-template name="gallery"/> -->
293 <xsl:call-template name="featureGallery" />
294 <!-- TODO to change to Figure Gallery: call figure gallery in the right
298 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
300 <!-- these templates provide the citations -->
302 <xsl:template name="display-references">
303 <xsl:text>{{EDIT_Reference_Section}}</xsl:text>
307 <xsl:template name="citations">
308 <xsl:param name="name-uuid" />
309 <xsl:param name="descriptionelements" />
311 <!--<ref name="{$name-uuid}"> -->
312 <!-- iterate through all the description elements for the citation feature -->
313 <xsl:for-each select="$descriptionelements/descriptionelement">
315 <xsl:sort select="sources/e[1]/citation/datePublished/start" />
317 <xsl:variable name="citation-uuid" select="sources/e[1]/citation/uuid" />
319 <xsl:for-each select="sources/e">
320 <xsl:if test="nameUsedInSource/uuid=$name-uuid">
322 <!-- call reference template with sources/e/citation -->
323 <xsl:call-template name="reference">
324 <xsl:with-param name="reference-node" select="citation" />
326 <!-- use the citation-uuid as a unique name for the reference -->
335 <!-- an example of mediawiki formtting of references: Mohrig, W.; Menzel,
336 F. 1992: Neue Arten europäischer Trauermücken (Diptera, Sciaridae). An International
337 Journal of Dipterological Research, 3(1-2), 1–16. Authors Date: title. inReferences
338 title in italics, Volume in bold(series), page range -->
339 <xsl:template name="reference">
340 <xsl:param name="reference-node" />
341 <!--TODO Do we need to sort the list of references in WikiMedia or will
342 they just appear in numbered order as they occur in the names -->
343 <!--xsl:sort select="sources/e[1]/citation/datePublished/start"/ -->
345 <!-- first of all check if any of the data we show exist: TODO remove this
346 test, if we modified CDM services, to export proper data -->
348 test="exists($reference-node/authorTeam/teamMembers/e[1]/lastname)
349 or exists($reference-node/authorTeam/lastname) or exists($reference-node/datePublished/start)
350 or exists($reference-node/title)">
352 <!-- use the citation-uuid as a unique name for the reference -->
353 <xsl:variable name="citation-uuid" select="$reference-node/uuid" />
355 <!-- use the citation-uuid as a unique name for the reference -->
357 select="concat('{{EDIT_Reference|name=',$citation-uuid,'|content=')" />
360 <xsl:when test="exists($reference-node/authorTeam/teamMembers)">
361 <xsl:text>{{aut|</xsl:text>
362 <xsl:for-each select="$reference-node/authorTeam/teamMembers/e">
363 <xsl:value-of select="lastname" />
365 <xsl:when test="position() != last()">
366 <xsl:text> & </xsl:text>
370 <xsl:text>}} </xsl:text>
374 <xsl:when test="exists($reference-node/authorTeam/lastname)">
375 <xsl:text>{{aut|</xsl:text>
376 <xsl:value-of select="$reference-node/authorTeam/lastname" />
377 <xsl:text>}} </xsl:text>
380 <xsl:value-of select="$reference-node/titleCache"></xsl:value-of>
388 <!-- DEBUGGING display uuid so can check references against those in Tax
390 <!--<xsl:if test="$reference-node/datePublished/start != ''"> <xsl:value-of
391 select="$reference-node/datePublished/start"/> <xsl:text>: </xsl:text> </xsl:if> -->
392 <xsl:apply-templates select="$reference-node/title" />
393 <!-- do we need any other info from inReference node - see flore-afrique-centrale.xsl
395 <xsl:variable name="wiki-markup">
399 <xsl:if test="$reference-node/inReference/node()">
401 select="concat($wiki-markup, $reference-node/inReference/title, $wiki-markup)" />
403 <xsl:apply-templates select="$reference-node/volume" />
404 <xsl:apply-templates select="$reference-node/series" />
405 <xsl:apply-templates select="$reference-node/pages" />
406 <xsl:apply-templates select="$reference-node/placePublished" />
407 <xsl:apply-templates select="$reference-node/publisher" />
409 <!--xsl:choose> <xsl:when test="$reference-node/inReference/node()"> <xsl:value-of
410 select="$reference-node/title"/> <xsl:text>. </xsl:text> <xsl:value-of select="$reference-node/inReference/title"/>
411 </xsl:when> <xsl:otherwise> <xsl:value-of select="$reference-node/title"/>
412 </xsl:otherwise> </xsl:choose> <xsl:text>.</xsl:text> <xsl:value-of select="$reference-node/pages"/>
413 <xsl:text>.</xsl:text> <xsl:if test="$reference-node/type = 'Book' or $reference-node/type
414 = 'BookSection'"> <xsl:if test="$reference-node/placePublished != '' or $reference-node/publisher
415 != ''"> <xsl:text> </xsl:text> <xsl:value-of select="$reference-node/placePublished"/>
416 <xsl:text>, </xsl:text> <xsl:value-of select="$reference-node/publisher"/>
417 <xsl:text>.</xsl:text> </xsl:if> </xsl:if -->
418 <xsl:text>}}</xsl:text>
421 <xsl:call-template name="wiki-newline-comment" />
424 <!-- wild card match for different children of nomenclaturalReference and
426 <xsl:template match="*">
429 <xsl:when test="name(.) = 'pages'">
430 <xsl:value-of select="replace(.,'‐','–')" />
433 <xsl:value-of select="." />
437 <!--<xsl:text>FOO </xsl:text> -->
439 test="name(.) = 'title' or name(.) = 'publisher' or name(.) = 'pages'">
440 <!-- . if publisher or title - comma if placePublished -->
441 <xsl:text>. </xsl:text>
444 <xsl:if test="name(.) = 'volume'">
445 <xsl:text>: </xsl:text>
448 test="(../type = 'Book' or ../type = 'BookSection') and name(.) = 'placePublished' and . != ''">
449 <xsl:text>, </xsl:text>
452 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
454 <!-- these templates provide the polytomous key For example: {{Lead | 1=4|
455 2= jeunes couverts de cils simples et glanduleux mais jamais de cils denticulés
456 ou branchus| result = Erica trimera (Flora of XX) | result text = ''Erica
458 <xsl:template match="key" name="key">
460 <xsl:param name="uuidFamily">
461 210a8214-4e69-401a-8e47-c7940d990bdd
463 <xsl:param name="uuidGenus">
464 1b11c34c-48a8-4efa-98d5-84f7f66ef43a
466 <xsl:param name="uuidSubgenus">
467 78786e16-2a70-48af-a608-494023b91904
470 <xsl:if test="HashMap/records/e">
472 <xsl:call-template name="chapter">
473 <xsl:with-param name="title">
478 <xsl:variable name="key-name" select="HashMap/titleCache" />
480 select="concat('{{Key Start | id =',$key-name,'|title=',$key-name,'|edited by=L.Morris}}')" />
483 <!--xsl:if test="ArrayList/e" -->
484 <xsl:for-each select="HashMap/records/e">
486 <xsl:variable name="node-number" select="nodeNumber" />
487 <xsl:variable name="child-statement" select="childStatement" />
489 <!-- TaxonLinkDto or PolytomousKeyNodeLinkDto -->
490 <!--xsl:value-of select="concat('{{Decision | id =', $node-number, '|
491 lead 1 = ', $child-statement)"/ -->
492 <xsl:value-of select="concat('{{Lead | 1 =', $node-number)" />
494 <xsl:if test="edgeNumber = 2">
495 <xsl:text>*</xsl:text>
498 <xsl:value-of select="concat('| 2 =', $child-statement)" />
502 <xsl:when test="links/e[1]/class = 'PolytomousKeyNodeLinkDto'">
503 <xsl:variable name="link-node-number" select="links/e[1]/nodeNumber" />
504 <xsl:value-of select="concat('| 3 =', $link-node-number)" />
506 <xsl:when test="links/e[1]/class = 'TaxonLinkDto'">
508 <xsl:text>| result = '' </xsl:text>
509 <xsl:variable name="taxonUuid" select="links/e[1]/uuid" />
510 <xsl:variable name="genus"
511 select="//Taxon/uuid[.=$taxonUuid]/../name/genusOrUninomial" />
513 <xsl:when test="taxonUuid = $uuidSubgenus">
514 <xsl:variable name="repr"
515 select="//Taxon/uuid[.='71cd0e8d-47eb-4c66-829a-e21c705ee660']/../name/rank/representation_L10n" />
516 <xsl:value-of select="concat($genus, '. ', $repr)" />
518 <xsl:when test="taxonUuid = $uuidGenus">
519 <xsl:apply-templates select="$genus" />
522 <xsl:variable name="specificEpithet"
523 select="//Taxon/uuid[.=$taxonUuid]/../name/specificEpithet" />
524 <!-- abbreviate the genus for species names -->
525 <xsl:value-of select="concat($genus, ' ', $specificEpithet)" />
528 <xsl:text>''</xsl:text>
533 <xsl:text>}}</xsl:text>
537 <xsl:text>{{Key End}}</xsl:text>
538 <xsl:call-template name="wiki-newline"></xsl:call-template>
543 <!-- this template provides the Credit to the source database -->
545 <xsl:template name="credit">
546 <xsl:call-template name="chapter">
547 <xsl:with-param name="title">
551 <xsl:apply-templates select="$cdm-credit-text"/><br></br>
554 <!-- these templates provide the synonomy -->
556 <xsl:template match="synonymy" name="synonymy">
557 <xsl:call-template name="chapter">
558 <xsl:with-param name="title">
562 <!--<xsl:text>{{EDIT_Taxon|</xsl:text> -->
563 <xsl:apply-templates select="../name">
564 <xsl:with-param name="type">
567 </xsl:apply-templates>
568 <!--<xsl:text>}}</xsl:text> -->
569 <xsl:call-template name="wiki-newline" />
570 <!-- getting nomenclatural refs and citaions for this name -->
571 <xsl:call-template name="reference">
572 <xsl:with-param name="reference-node" select="../name/nomenclaturalReference" />
574 <xsl:call-template name="citations">
575 <xsl:with-param name="descriptionelements"
576 select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements" />
577 <xsl:with-param name="name-uuid" select="../name/uuid" />
579 <xsl:apply-templates select="homotypicSynonymsByHomotypicGroup" />
580 <xsl:apply-templates select="heterotypicSynonymyGroups" />
581 <xsl:call-template name="wiki-newline" />
582 <xsl:call-template name="wiki-newline" />
583 <!--xsl:call-template name="citations"> <xsl:with-param name="descriptionelements"
584 select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements"/>
585 <xsl:with-param name="name-uuid" select="../name/uuid"/> </xsl:call-template -->
588 <!--............................................. -->
590 <xsl:template match="homotypicSynonymsByHomotypicGroup">
591 <xsl:for-each select="e">
592 <xsl:text>{{EDIT Homotypic Synonym|1|</xsl:text>
593 <xsl:apply-templates select="name" />
594 <xsl:text>}}</xsl:text>
595 <xsl:call-template name="wiki-newline-comment" />
596 <!--homotypicSynonymsByHomotypicGroup/e/name/nomenclaturalReference -->
597 <!--xsl:apply-templates select="name/nomenclaturalReference"/ -->
598 <xsl:for-each select="name/homotypicalGroup/typifiedNames/e">
599 <xsl:call-template name="reference">
600 <xsl:with-param name="reference-node" select="nomenclaturalReference" />
603 <xsl:call-template name="reference">
604 <xsl:with-param name="reference-node" select="name/nomenclaturalReference" />
609 <!--LORNA Pass the description elements for the citation 99b2842f-9aa7-42fa-bd5f-7285311e0101 -->
610 <xsl:call-template name="citations">
611 <xsl:with-param name="descriptionelements"
612 select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements" />
613 <xsl:with-param name="name-uuid" select="name/uuid" />
618 <!--............................................. -->
620 <xsl:template match="heterotypicSynonymyGroups">
621 <xsl:for-each select="e">
622 <!-- take the first one to printout as the head of the homotypic group -->
623 <xsl:variable name="first-element" select="e[1]" />
624 <xsl:text>{{EDIT Heterotypic Synonym|1|</xsl:text>
625 <xsl:apply-templates select="$first-element/name" />
626 <xsl:text>}}</xsl:text>
628 <xsl:call-template name="wiki-newline-comment" />
629 <xsl:call-template name="reference">
630 <xsl:with-param name="reference-node"
631 select="$first-element/name/nomenclaturalReference" />
634 <xsl:for-each select="name/homotypicalGroup/typifiedNames/e">
635 <xsl:call-template name="reference">
636 <xsl:with-param name="reference-node"
637 select="$first-element/nomenclaturalReference" />
641 <!-- take the first one to printout as the head of the homotypic group -->
642 <!--do foreach for the rest -->
643 <xsl:for-each select="e[position() > 1]">
644 <!--xsl:for-each select="e" -->
645 <xsl:text>{{EDIT Homotypic Synonym|2|</xsl:text>
646 <xsl:apply-templates select="name" />
647 <xsl:text>}}</xsl:text>
648 <xsl:call-template name="wiki-newline-comment" />
649 <xsl:call-template name="reference">
650 <xsl:with-param name="reference-node" select="name/nomenclaturalReference" />
653 <xsl:for-each select="name/homotypicalGroup/typifiedNames/e">
654 <xsl:call-template name="reference">
655 <xsl:with-param name="reference-node" select="nomenclaturalReference" />
659 <!--LORNA Pass the description elements for the citation 99b2842f-9aa7-42fa-bd5f-7285311e0101 -->
660 <xsl:call-template name="citations">
661 <xsl:with-param name="descriptionelements"
662 select="../descriptions/features/feature[uuid='99b2842f-9aa7-42fa-bd5f-7285311e0101']/descriptionelements" />
663 <xsl:with-param name="name-uuid" select="name/uuid" />
667 <!--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 -->
670 <!--............................................. -->
672 <xsl:template match="name" name="name">
673 <xsl:param name="type" />
674 <xsl:apply-templates select="taggedName">
675 <xsl:with-param name="type" select="$type" />
676 </xsl:apply-templates>
677 <!--xsl:apply-templates select="nomenclaturalReference"/ -->
680 <!--............................................. -->
682 <xsl:template match="taggedName">
683 <xsl:param name="type" />
685 <xsl:when test="$type!=''">
686 <xsl:value-of select="concat('{{EDIT_',normalize-space($type),'|')" />
687 <xsl:for-each select="e">
689 <xsl:when test="type='name'">
690 <xsl:apply-templates select="text" />
691 <xsl:text> </xsl:text>
693 <xsl:when test="type='authors'">
694 <xsl:text>}}</xsl:text>
696 select="concat('{{EDIT_',normalize-space($type),'_Author|')" />
697 <xsl:apply-templates select="text" />
698 <xsl:text>}}</xsl:text>
704 <xsl:for-each select="e">
705 <xsl:apply-templates select="text" />
706 <xsl:text> </xsl:text>
714 <!-- TODO mybe some types don't contain font tags, we don't have to call
716 <!-- we could just use <xsl:value-of select="text"/> -->
719 <!--<xsl:text>
</xsl:text> -->
722 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
724 <!-- description features -->
726 <!-- TODO: for first and second level: check if there is a page that describes
727 the feature and use Parameter "Link=pagename" with templates Tax_Feature
728 or Second_Level_Feature -->
730 <xsl:template match="descriptions" name="descriptions">
731 <xsl:call-template name="wiki-comment">
732 <xsl:with-param name="wiki-comment">
736 <xsl:for-each select="features/feature">
738 <xsl:when test="count(feature)!=0">
739 <xsl:call-template name="secondLevelDescriptionElements" />
742 <!-- everything but Citation -->
743 <xsl:if test="uuid!='99b2842f-9aa7-42fa-bd5f-7285311e0101'">
744 <xsl:call-template name="descriptionElements" />
746 <!--xsl:apply-templates select="media/e/representations/e/parts/e/uri"/ -->
753 <!--............................................. -->
755 <xsl:template name="secondLevelDescriptionElements">
758 select="concat('{{EDIT_Highlevel_Feature|',representation_L10n,'}}')" />
759 <xsl:call-template name="wiki-newline" />
760 <xsl:for-each select="feature">
761 <!-- TODO assign TermBase description to parameter description- after
762 exporting it from CDM -->
763 <xsl:if test="uuid!='6dfb4e78-c67e-410c-8989-c1fb1295abf6'">
765 select="concat('{{EDIT_Nested_Feature|name=',representation_L10n,'|description=',representation_L10n,'|elements=')" />
766 <xsl:call-template name="wiki-newline" />
767 <!-- TODO create Elements -->
768 <xsl:for-each select="descriptionelements/descriptionelement">
770 select="concat('{{EDIT_Nested_Feature_Element|',multilanguageText_L10n/text, '}}')" />
773 <xsl:when test="position() != last()">
774 <xsl:text>{{EDIT_Delimiter}}</xsl:text>
777 <xsl:if test="position() != last()">
778 <xsl:call-template name="wiki-newline" />
781 <xsl:text>}}</xsl:text>
782 <xsl:call-template name="wiki-newline" />
785 <xsl:for-each select="feature">
786 <xsl:if test="uuid='6dfb4e78-c67e-410c-8989-c1fb1295abf6'">
787 <xsl:call-template name="featureGallery" />
790 <xsl:call-template name="wiki-newline" />
793 <!--............................................. -->
796 <xsl:template name="descriptionElements">
798 <xsl:when test="supportsCommonTaxonName='true'">
799 <!-- must be Vernacular Name feature -->
800 <xsl:call-template name="commonTaxonName" />
803 <!-- for example Habitat, Material Examined -->
804 <xsl:call-template name="textData" />
809 <!--............................................. -->
811 <xsl:template name="commonTaxonName">
814 select="concat('{{EDIT_Feature|name=',representation_L10n,'|elements=')" />
815 <xsl:call-template name="wiki-newline" />
816 <xsl:for-each select="descriptionelements/descriptionelement">
819 select="concat('{{EDIT_Common_Name|name=',name,'|language=',language/representation_L10n,'}}')" />
821 <xsl:when test="position() != last()">
822 <xsl:text>{{EDIT_Delimiter}}</xsl:text>
823 <xsl:call-template name="wiki-newline" />
827 <xsl:text>}}</xsl:text>
828 <xsl:call-template name="wiki-newline" />
829 <xsl:call-template name="wiki-newline" />
832 <!--............................................. -->
834 <xsl:template name="textData">
837 select="concat('{{EDIT_Feature|name=',representation_L10n, '|elements=')" />
838 <xsl:call-template name="wiki-newline" />
839 <xsl:text>{{EDIT_Feature_Text|</xsl:text>
840 <!-- <xsl:choose> <xsl:when test="uuid!='9fc9d10c-ba50-49ee-b174-ce83fc3f80c6'"> -->
841 <!-- feature is not "Distribution" -->
843 select="descriptionelements/descriptionelement[1]/multilanguageText_L10n/text" />
844 <xsl:call-template name="reference">
845 <xsl:with-param name="reference-node" select="descriptionelements/descriptionelement[1]/sources[1]/e[1]/citation[1]" />
849 select="descriptionelements/descriptionelement[1]/sources[1]/e[1]/citation[1]/titleCache[1]" />
852 <!-- </xsl:when> </xsl:choose> -->
853 <xsl:text>}}}}</xsl:text>
854 <!-- feature is "Figures -->
855 <!-- A Gallery: uncomment following line -->
856 <!--<xsl:apply-templates select="descriptionelements/descriptionelement[1]/multilanguageText_L10n/text"/> -->
857 <!-- A Gallery: comment following line -->
858 <!--xsl:call-template name="gallery"/ -->
860 <xsl:call-template name="wiki-newline" />
861 <xsl:call-template name="wiki-newline" />
862 <!-- LORNA TRY IMAGE HERE -->
863 <!--xsl:apply-templates select="descriptionelements/descriptionelement[1]/media/e/representations/e/parts/e/uri"/ -->
868 <!--............................................. -->
871 <xsl:template match="text">
872 <xsl:call-template name="replace-tags-others">
873 <xsl:with-param name="text-string" select="." />
877 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
878 <!-- image galleries -->
880 <xsl:template name="gallery">
881 <!-- A change to Figure Gallery: delete/comment following line -->
882 <xsl:text>{{EDIT_Gallery|files=</xsl:text>
883 <!-- A change to Figure Gallery: uncomment following line -->
884 <!--<xsl:text>{{EDIT_Figure_Gallery|files=</xsl:text> -->
885 <xsl:call-template name="wiki-newline" />
886 <xsl:apply-templates select="../media/e/representations/e/parts/e/uri" />
888 <xsl:text>}}</xsl:text>
889 <xsl:call-template name="wiki-newline" />
890 <xsl:call-template name="wiki-newline" />
894 <xsl:template name="featureGallery">
897 select="concat('{{EDIT_Nested_Feature|name=',representation_L10n,'|description=',representation_L10n,'|elements=}}')" />
898 <xsl:text>{{EDIT_Figure_Gallery|files=</xsl:text>
900 <xsl:call-template name="wiki-newline" />
901 <xsl:apply-templates select=".//media/e/representations/e/parts/e/uri" />
903 <xsl:text>}}</xsl:text>
904 <xsl:call-template name="wiki-newline" />
905 <xsl:call-template name="wiki-newline" />
907 <xsl:call-template name="gallery_file" />
912 <xsl:template name="gallery_file" />
914 <xsl:template match="media/e/representations/e/parts/e/uri">
917 select="concat('{{EDIT_Gallery_File|filename=',functx:substring-after-last(.,'/'), '|description=')" />
918 <!--go back up to the description element and get the text for the Figure
920 <xsl:apply-templates select="../../../../../../../multilanguageText_L10n/text" />
921 <xsl:apply-templates select="../../../../../../../name/titleCache" />
922 <xsl:text>}}</xsl:text>
923 <xsl:if test="position() != last()">
924 <xsl:call-template name="wiki-newline" />
931 <!--+++++++++++++++++++++++++++++L A Y O U T ++++++++++++++++++++++++++++++++++++++ -->
934 <!-- change here to change the look of the mediawiki output -->
935 <!-- please use mediawiki templates -->
936 <!-- think also of template changes in the mediawiki -->
938 <xsl:template name="TOC">
942 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
943 <xsl:template name="chapter">
944 <xsl:param name="title" />
945 <xsl:value-of select="concat('{{EDIT_Section|title=',$title,'}}')" />
946 <xsl:call-template name="wiki-newline" />
947 <xsl:call-template name="wiki-newline" />
950 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
952 <xsl:template name="subchapter">
953 <xsl:param name="title" />
954 <xsl:value-of select="concat('{{EDIT_Subsection|title=',$title,'}}')" />
955 <xsl:call-template name="wiki-newline" />
956 <xsl:call-template name="wiki-newline" />
959 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
960 <!-- puts in a wiki comment -->
961 <xsl:template name="wiki-comment">
962 <xsl:param name="wiki-comment" />
964 <xsl:value-of select="concat($wiki-comment,'
')" />
968 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
970 <!--this template layouts and displays the name of a taxon depending on
971 it's "kind" MAYDO: create more useful layouts instead of title sizes -->
972 <xsl:template name="display-taxon-name">
973 <xsl:param name="taxon" />
974 <!-- get the name of the taxon -->
975 <xsl:variable name="name">
976 <xsl:call-template name="title">
977 <xsl:with-param name="taxon" select="$taxon" />
980 <!-- format the name of the taxon according to it's kind -->
984 test="$taxon/name/rank/uuid='af5f2481-3192-403f-ae65-7c957a0f02b6'">
985 <xsl:value-of select="concat('{{EDIT_Family_Name|', $name, '}}')" />
989 test="$taxon/name/rank/uuid='1b11c34c-48a8-4efa-98d5-84f7f66ef43a'">
990 <xsl:value-of select="concat('{{EDIT_Genus Name|', $name, '}}')" />
995 test="$taxon/name/rank/uuid='78786e16-2a70-48af-a608-494023b91904'">
996 <xsl:value-of select="concat('{{EDIT_Subgenus Name|', $name, '}}')" />
1000 test="$taxon/name/rank/uuid='b301f787-f319-4ccc-a10f-b4ed3b99a86d'">
1001 <xsl:value-of select="concat('{{EDIT_Species Name|', $name, '}}')" />
1004 <!-- for debugging -->
1005 Unformatted title for rank uuid:
1006 <xsl:value-of select="$taxon/name/rank/uuid" />
1008 <xsl:value-of select="$taxon/name/titleCache" />
1014 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
1016 <!--we replace "escaped" html <i> and <b> with mediawiki markup -->
1017 <!--............................................. -->
1019 <xsl:template name="replace-tags-others">
1020 <xsl:param name="text-string" />
1021 <!-- first replace bold tags and put the result in text-string2 -->
1022 <xsl:variable name="text-string2">
1023 <xsl:call-template name="add-markup">
1024 <xsl:with-param name="str" select="$text-string" />
1025 <xsl:with-param name="wiki-markup">
1028 <xsl:with-param name="tag-name">
1031 </xsl:call-template>
1034 <!-- second replace italic tags on text-string2 -->
1035 <xsl:variable name="text-string3">
1036 <xsl:call-template name="add-markup">
1037 <xsl:with-param name="str" select="$text-string2" />
1038 <xsl:with-param name="wiki-markup">
1041 <xsl:with-param name="tag-name">
1044 </xsl:call-template>
1048 <!-- third wrap = with <nowiki> tag -->
1049 <xsl:call-template name="wrap-a-sequence-with-tags">
1050 <xsl:with-param name="str" select="$text-string3" />
1051 <xsl:with-param name="pattern">=</xsl:with-param>
1052 <xsl:with-param name="tag-name">nowiki</xsl:with-param>
1053 </xsl:call-template>
1055 <!--............................................. -->
1057 <xsl:template name="add-markup">
1058 <xsl:param name="str" />
1059 <xsl:param name="wiki-markup" />
1060 <xsl:param name="tag-name" />
1062 <xsl:variable name="opening-tag">
1063 <xsl:value-of select="concat('<', $tag-name, '>')">
1066 <xsl:variable name="closing-tag">
1067 <xsl:value-of select="concat('</', $tag-name, '>')">
1072 <!-- if the tag occures in the string -->
1074 test="contains($str, $opening-tag) and contains($str, $closing-tag)">
1076 <!-- separate string before, inside and after the tag -->
1077 <xsl:variable name="before-tag"
1078 select="substring-before($str, $opening-tag)" />
1079 <xsl:variable name="inside-tag"
1080 select="substring-before(substring-after($str,$opening-tag),$closing-tag)" />
1081 <xsl:variable name="after-tag"
1082 select="substring-after($str, $closing-tag)" />
1084 <!-- built the new string by putting in the mediawiki template -->
1086 select="concat($before-tag, $wiki-markup, $inside-tag, $wiki-markup)" />
1087 <!-- in the part after the closing tag could be more tag, so we do a
1089 <xsl:call-template name="add-markup">
1090 <xsl:with-param name="str" select="$after-tag" />
1091 <xsl:with-param name="wiki-markup" select="$wiki-markup" />
1092 <xsl:with-param name="tag-name" select="$tag-name" />
1093 </xsl:call-template>
1096 <xsl:value-of select="$str" />
1101 <!--............................................. -->
1103 <xsl:template name="wrap-a-sequence-with-tags">
1105 <!-- the string we operate on -->
1106 <xsl:param name="str" />
1107 <!-- the sequence we want to put tags arround e.g. "=" -->
1108 <xsl:param name="pattern"/>
1109 <!-- the tag name e.g. nowiki -->
1110 <xsl:param name="tag-name" />
1111 <!--xsl:value-of>###in wrap</xsl:value-of-->
1112 <xsl:variable name="new-pattern">
1113 <xsl:value-of select="concat('<',$tag-name,'>',$pattern,'</',$tag-name,'>')">
1117 <xsl:value-of select="replace($str,$pattern, $new-pattern)"></xsl:value-of>
1120 <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->