Vancouver XSL
Vancouver XSL
Vancouver XSL
>
<!--
Stylesheet for Microsoft Word 2007/2008/2010 Bibliography formatting.
<xsl:stylesheet version="1.0"
xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<!-- Variable containing all necessary data for a certain style of bibliography. -->
<xsl:variable name="data">
<general>
<stylename>Vancouver</stylename>
<version>2009.05.23</version>
<description>An implementation of the Vancouver style.</description>
<URL></URL>
<author>Yves Dhondt (yves.dhondt@gmail.com)</author>
<comments></comments>
<display_errors>yes</display_errors>
<citation_as_link>no</citation_as_link>
</general>
<importantfields>
<source type="Book">
<b:ImportantField>b:Author/b:Author/b:NameList</b:ImportantField>
<b:ImportantField>b:Author/b:Editor/b:NameList</b:ImportantField>
<b:ImportantField>b:Title</b:ImportantField>
<b:ImportantField>b:Year</b:ImportantField>
<b:ImportantField>b:City</b:ImportantField>
<b:ImportantField>b:Publisher</b:ImportantField>
<b:ImportantField>b:Edition</b:ImportantField>
</source>
<source type="BookSection">
<b:ImportantField>b:Author/b:Author/b:NameList</b:ImportantField>
<b:ImportantField>b:Title</b:ImportantField>
<b:ImportantField>b:Author/b:BookAuthor/b:NameList</b:ImportantField>
<b:ImportantField>b:BookTitle</b:ImportantField>
<b:ImportantField>b:Author/b:Editor/b:NameList</b:ImportantField>
<b:ImportantField>b:City</b:ImportantField>
<b:ImportantField>b:Publisher</b:ImportantField>
<b:ImportantField>b:Year</b:ImportantField>
<b:ImportantField>b:Pages</b:ImportantField>
</source>
<source type="JournalArticle">
<b:ImportantField>b:Author/b:Author/b:NameList</b:ImportantField>
<b:ImportantField>b:Title</b:ImportantField>
<b:ImportantField>b:JournalName</b:ImportantField>
<b:ImportantField>b:Volume</b:ImportantField>
<b:ImportantField>b:Issue</b:ImportantField>
<b:ImportantField>b:Month</b:ImportantField>
<b:ImportantField>b:Year</b:ImportantField>
<b:ImportantField>b:Pages</b:ImportantField>
</source>
<source type="ArticleInAPeriodical">
<b:ImportantField>b:Author/b:Author/b:NameList</b:ImportantField>
<b:ImportantField>b:Title</b:ImportantField>
<b:ImportantField>b:PeriodicalTitle</b:ImportantField>
<b:ImportantField>b:Volume</b:ImportantField>
<b:ImportantField>b:Issue</b:ImportantField>
<b:ImportantField>b:Pages</b:ImportantField>
<b:ImportantField>b:Month</b:ImportantField>
<b:ImportantField>b:Year</b:ImportantField>
</source>
<source type="ConferenceProceedings">
<b:ImportantField>b:Author/b:Author/b:NameList</b:ImportantField>
<b:ImportantField>b:Title</b:ImportantField>
<b:ImportantField>b:ConferenceName</b:ImportantField>
<b:ImportantField>b:City</b:ImportantField>
<b:ImportantField>b:CountryRegion</b:ImportantField>
<b:ImportantField>b:Month</b:ImportantField>
<b:ImportantField>b:Year</b:ImportantField>
<b:ImportantField>b:Pages</b:ImportantField>
</source>
<source type="Report">
<b:ImportantField>b:Author/b:Author/b:NameList</b:ImportantField>
<b:ImportantField>b:Title</b:ImportantField>
<b:ImportantField>b:ThesisType</b:ImportantField>
<b:ImportantField>b:Institution</b:ImportantField>
<b:ImportantField>b:City</b:ImportantField>
<b:ImportantField>b:Department</b:ImportantField>
<b:ImportantField>b:StandardNumber</b:ImportantField>
<b:ImportantField>b:Year</b:ImportantField>
<b:ImportantField>b:Pages</b:ImportantField>
</source>
<source type="InternetSite">
<b:ImportantField>b:Author/b:Author/b:NameList</b:ImportantField>
<b:ImportantField>b:InternetSiteTitle</b:ImportantField>
<b:ImportantField>b:Year</b:ImportantField>
<b:ImportantField>b:YearAccessed</b:ImportantField>
<b:ImportantField>b:MonthAccessed</b:ImportantField>
<b:ImportantField>b:DayAccessed</b:ImportantField>
<b:ImportantField>b:URL</b:ImportantField>
</source>
<source type="DocumentFromInternetSite">
<b:ImportantField>b:Author/b:Author/b:NameList</b:ImportantField>
<b:ImportantField>b:InternetSiteTitle</b:ImportantField>
<b:ImportantField>b:Year</b:ImportantField>
<b:ImportantField>b:YearAccessed</b:ImportantField>
<b:ImportantField>b:MonthAccessed</b:ImportantField>
<b:ImportantField>b:DayAccessed</b:ImportantField>
<b:ImportantField>b:URL</b:ImportantField>
</source>
<source type="ElectronicSource">
<b:ImportantField>b:Author/b:Author/b:NameList</b:ImportantField>
<b:ImportantField>b:InternetSiteTitle</b:ImportantField>
<b:ImportantField>b:Year</b:ImportantField>
<b:ImportantField>b:YearAccessed</b:ImportantField>
<b:ImportantField>b:MonthAccessed</b:ImportantField>
<b:ImportantField>b:DayAccessed</b:ImportantField>
<b:ImportantField>b:Medium</b:ImportantField>
<b:ImportantField>b:URL</b:ImportantField>
</source>
<source type="Patent">
<b:ImportantField>b:Author/b:Inventor/b:NameList</b:ImportantField>
<b:ImportantField>b:Author/b:Editor/b:NameList</b:ImportantField>
<b:ImportantField>b:Title</b:ImportantField>
<b:ImportantField>b:CountryRegion</b:ImportantField>
<b:ImportantField>b:PatentNumber</b:ImportantField>
<b:ImportantField>b:Month</b:ImportantField>
<b:ImportantField>b:Day</b:ImportantField>
<b:ImportantField>b:Year</b:ImportantField>
</source>
<source type="Misc">
<b:ImportantField>b:Author/b:Author/b:NameList</b:ImportantField>
<b:ImportantField>b:Title</b:ImportantField>
<b:ImportantField>b:Year</b:ImportantField>
<b:ImportantField>b:Comments</b:ImportantField>
</source>
</importantfields>
<citation>
<openbracket>(</openbracket>
<closebracket>)</closebracket>
<separator>,</separator>
<source type="Book">
<format>{%RefOrder%}</format>
</source>
<source type="BookSection">
<format>{%RefOrder%}</format>
</source>
<source type="JournalArticle">
<format>{%RefOrder%}</format>
</source>
<source type="ArticleInAPeriodical">
<format>{%RefOrder%}</format>
</source>
<source type="ConferenceProceedings">
<format>{%RefOrder%}</format>
</source>
<source type="Report">
<format>{%RefOrder%}</format>
</source>
<source type="InternetSite">
<format>{%RefOrder%}</format>
</source>
<source type="DocumentFromInternetSite">
<format>{%RefOrder%}</format>
</source>
<source type="ElectronicSource">
<format>{%RefOrder%}</format>
</source>
<source type="Patent">
<format>{%RefOrder%}</format>
</source>
<source type="Misc">
<format>{%RefOrder%}</format>
</source>
</citation>
<bibliography>
<columns>2</columns>
<source type="Book">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1|Editor:2%. }{%Title%{. %Edition:o% ed.}}{ %Editor:2%.}
{ %City|CountryRegion%}{: %Publisher%}{; %Year%}.</format>
</column>
<sortkey></sortkey>
</source>
<source type="BookSection">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1|BookAuthor:1|Editor:2%. }{%Title%. }In {%Editor:2|
BookAuthor:1%. }{%BookTitle%{. %Edition:o% ed.}}.{ %City|CountryRegion%}{: %Publisher%}
{; %Year%.}{ %Pages:p. :p. %}.</format>
</column>
<sortkey></sortkey>
</source>
<source type="JournalArticle">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1%. }{%Title%. }{%JournalName%. }{%Year%{ %Month:s%{ %Day
%}}};{ %Volume%}{(%Issue%)}{: %Pages: : %}.</format>
</column>
<sortkey></sortkey>
</source>
<source type="ArticleInAPeriodical">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1%. }{%Title%. }{%PeriodicalTitle%. }{%Year%{ %Month:s%
{ %Day%}}}{: %Pages:p. :p. %}.</format>
</column>
<sortkey></sortkey>
</source>
<source type="ConferenceProceedings">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1%. }{%Title%. In }{%Editor:2%. }{%ConferenceName%}{; %Year%
{ %Month:s%{ %Day%}}}{; %City|CountryRegion%}{: %Publisher%}{; %Year%}.{ %Pages:p. :p.
%.}</format>
</column>
<sortkey></sortkey>
</source>
<source type="Report">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1%. }{%Title%. }{%ThesisType%. }{%City%:}{ %Institution%}{,
%Department%}{; %Year%{ %Month:s%{ %Day%}}}.{ Report No.: %StandardNumber%}.</format>
</column>
<sortkey></sortkey>
</source>
<source type="InternetSite">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1%. }{%InternetSiteTitle|Title%. }[Online].{ %City%}{:
%Publisher%}{; %Year% }{ [cited %YearAccessed%{ %MonthAccessed%{ %DayAccessed%}}}
{ [%Comments%]}.{ Available from: %URL:l%.}</format>
</column>
<sortkey></sortkey>
</source>
<source type="DocumentFromInternetSite">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1%. }{%InternetSiteTitle|Title%. }[Online].{ %City%}{:
%Publisher%}{; %Year% }{ [cited %YearAccessed%{ %MonthAccessed%{ %DayAccessed%}}}
{ [%Comments%]}.{ Available from: %URL:l%.}</format>
</column>
<sortkey></sortkey>
</source>
<source type="ElectronicSource">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1%. }{%Title% }{[%Medium%]}.{ %City%}{: %Publisher%}{; %Year
% }{ [cited %YearAccessed%{ %MonthAccessed%{ %DayAccessed%}}}{ [%Comments%]}.{
Available from: %URL:l%.}</format>
</column>
<sortkey></sortkey>
</source>
<source type="Patent">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Inventor:3%; }{%Editor:1%, assignee. }{%Title%. }{%CountryRegion% }
{patent %PatentNumber%}{. %Year%{ %Month:s%{ %Day%}}}.</format>
</column>
<sortkey></sortkey>
</source>
<source type="Misc">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1%. }{%Title%. }{%Year%{ %Month:s%{ %Day%}}. }{%Comments
%}.</format>
</column>
<sortkey></sortkey>
</source>
<source type="Thesis">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1%. }{%Title% }{[%ThesisType%]}. {%City%}{: %Institution%}{;
%Year%}</format>
</column>
<sortkey></sortkey>
</source>
<source type="ElectronicArticle">
<column id="1">
<halign>right</halign>
<valign>top</valign>
<format>{%RefOrder%.}</format>
</column>
<column id="2">
<halign>left</halign>
<valign>top</valign>
<format>{%Author:1%. }{%Title%. }{%JournalName% [serial online]. }{%Year%
{ %Month:s%{ %Day%}}}{ [%YearAccessed%{ %MonthAccessed%{ %DayAccessed%}}]};{ %Volume%}
{(%Issue%)}{: Available from: %URL:l%}.</format>
</column>
<sortkey></sortkey>
</source>
</bibliography>
<namelists>
<list name="sort" id="0">
<single_prefix></single_prefix>
<multi_prefix></multi_prefix>
<corporate>{%Corporate%}</corporate>
<first_person>{%Last|First%}</first_person>
<other_persons>{%Last|First%}</other_persons>
<separator_between_if_two> </separator_between_if_two>
<separator_between_if_more_than_two> </separator_between_if_more_than_two>
<separator_before_last></separator_before_last>
<max_number_of_persons_to_display>500</max_number_of_persons_to_display>
<number_of_persons_to_display_if_more_than_max>500</number_of_persons_to_display_if_mor
e_than_max>
<overflow></overflow>
<single_suffix></single_suffix>
<multi_suffix></multi_suffix>
</list>
<list name="author" id="1">
<single_prefix></single_prefix>
<multi_prefix></multi_prefix>
<corporate>{%Corporate%}</corporate>
<first_person>{%Last% }{%First:a%}{%Middle:a%}</first_person>
<other_persons>{%Last% }{%First:a%}{%Middle:a%}</other_persons>
<separator_between_if_two>, </separator_between_if_two>
<separator_between_if_more_than_two>, </separator_between_if_more_than_two>
<separator_before_last>, </separator_before_last>
<max_number_of_persons_to_display>6</max_number_of_persons_to_display>
<number_of_persons_to_display_if_more_than_max>6</number_of_persons_to_display_if_more_
than_max>
<overflow>, et al.</overflow>
<single_suffix></single_suffix>
<multi_suffix></multi_suffix>
</list>
<list name="editor" id="2">
<single_prefix></single_prefix>
<multi_prefix></multi_prefix>
<corporate>{%Corporate%}</corporate>
<first_person>{%Last% }{%First:a%}{%Middle:a%}</first_person>
<other_persons>{%Last% }{%First:a%}{%Middle:a%}</other_persons>
<separator_between_if_two>, </separator_between_if_two>
<separator_between_if_more_than_two>, </separator_between_if_more_than_two>
<separator_before_last>, </separator_before_last>
<max_number_of_persons_to_display>6</max_number_of_persons_to_display>
<number_of_persons_to_display_if_more_than_max>6</number_of_persons_to_display_if_more_
than_max>
<overflow>, et al.</overflow>
<single_suffix>, editor</single_suffix>
<multi_suffix>, editors</multi_suffix>
</list>
<list name="inventor" id="3">
<single_prefix></single_prefix>
<multi_prefix></multi_prefix>
<corporate>{%Corporate%}</corporate>
<first_person>{%Last% }{%First:a%}{%Middle:a%}</first_person>
<other_persons>{%Last% }{%First:a%}{%Middle:a%}</other_persons>
<separator_between_if_two>, </separator_between_if_two>
<separator_between_if_more_than_two>, </separator_between_if_more_than_two>
<separator_before_last>, </separator_before_last>
<max_number_of_persons_to_display>6</max_number_of_persons_to_display>
<number_of_persons_to_display_if_more_than_max>6</number_of_persons_to_display_if_more_
than_max>
<overflow>, et al.</overflow>
<single_suffix>, inventor</single_suffix>
<multi_suffix>, inventors</multi_suffix>
</list>
</namelists>
<strings>
<months>
<month number="1">Jan</month>
<month number="2">Feb</month>
<month number="3">Mar</month>
<month number="4">Apr</month>
<month number="5">May</month>
<month number="6">Jun</month>
<month number="7">Jul</month>
<month number="8">Aug</month>
<month number="9">Sep</month>
<month number="10">Oct</month>
<month number="11">Nov</month>
<month number="12">Dec</month>
</months>
</strings>
</xsl:variable>
<!-- Indicates that all output will be in the HTML format. -->
<xsl:output method="html" encoding="utf-8"/>
<xsl:choose>
<!-- Gets the name of the style as it will be displayed in Word 2007 / 2010. -->
<xsl:when test="b:StyleName">
<xsl:value-of select="msxsl:node-set($data)/general/stylename"/>
</xsl:when>
<!-- Gets the version information for the style in Word 2007 / 2010. -->
<xsl:when test="b:Version">
<xsl:value-of select="msxsl:node-set($data)/general/version"/>
</xsl:when>
<!-- Gets the URL for updates. (Word 2008 or later) -->
<xsl:when test="b:UpdateURL">
<xsl:value-of select="msxsl:node-set($data)/general/URL"/>
</xsl:when>
<!-- Retrieve the most important fields for a certain type of citation. -->
<xsl:when test="b:GetImportantFields">
<xsl:variable name="type" select="b:GetImportantFields/b:SourceType"/>
<b:ImportantFields>
<xsl:copy-of select="msxsl:node-set($data)/importantfields/source[@type =
$type]/*"/>
</b:ImportantFields>
</xsl:when>
<!-- Formats a footnote citation for display (Word 2008 or later). -->
<xsl:when test="b:FootnoteCitation">
<xsl:choose>
<xsl:when test="msxsl:node-set($data)/footnotecitation">
<xsl:call-template name="format-footnote-citation"/>
</xsl:when>
<xsl:otherwise>
<!-- Fallback method. -->
<xsl:call-template name="format-citation"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Add a b:BibOrder element to b:Source elements (not used by Word, BibWord
specific!). -->
<xsl:when test="b:BibWord">
<xsl:call-template name="bibword-extensions"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<html xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<p>
<!-- Display the open bracket if this is the first citation. -->
<xsl:if test="/b:Citation/b:FirstAuthor">
<xsl:value-of select="$params/citation/openbracket" disable-output-
escaping="yes"/>
</xsl:if>
<xsl:choose>
<!-- If there is no source type, its a placeholder. -->
<xsl:when test="string-length($sourcetype) = 0 and string-
length(msxsl:node-set($data)/citation/source[@type = 'Placeholder']/format) > 0">
<xsl:value-of select="msxsl:node-set($data)/citation/source[@type =
'Placeholder']/format"/>
</xsl:when>
<!-- Go for the type element if available. -->
<xsl:when test="string-length($type) > 0 and string-length(msxsl:node-
set($data)/citation/source[@type = $type]/format) > 0 ">
<xsl:value-of select="msxsl:node-set($data)/citation/source[@type =
$type]/format"/>
</xsl:when>
<!-- Else go for the source type element if available. -->
<xsl:when
test="string-length(msxsl:node-set($data)/citation/source[@type = $sourcetype]/format)
> 0 ">
<xsl:value-of select="msxsl:node-set($data)/citation/source[@type =
$sourcetype]/format"/>
</xsl:when>
<!-- Else display error message. -->
<xsl:otherwise>
<xsl:if test="msxsl:node-set($data)/general/display_errors = 'yes'">
<xsl:text><b>Unsupported </xsl:text>
<xsl:if test="string-length($type) > 0">
<xsl:text>type (</xsl:text>
<xsl:value-of select="$type"/>
<xsl:text>) and </xsl:text>
</xsl:if>
<xsl:text>source type (</xsl:text>
<xsl:value-of select="$sourcetype"/>
<xsl:text>) for source </xsl:text>
<xsl:value-of select="/b:Citation/b:Source/b:Tag"/>
<xsl:text>.</b></xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="format-source">
<xsl:with-param name="format" select="$format"/>
<xsl:with-param name="source"
select="msxsl:node-set($extendedSource)/b:Source"/>
<xsl:with-param name="disallowed">
<!-- Do not display the authors of the work. -->
<xsl:if test="/b:Citation/b:NoAuthor">
<xsl:value-of select="msxsl:node-set($data)/citation/noauthor"/>
</xsl:if>
<!-- Do not display the title of the work. -->
<xsl:if test="/b:Citation/b:NoTitle">
<xsl:value-of select="msxsl:node-set($data)/citation/notitle"/>
</xsl:if>
<!-- Do not display the year the work was written or accessed in. -->
<xsl:if test="/b:Citation/b:NoYear">
<xsl:value-of select="msxsl:node-set($data)/citation/noyear"/>
</xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$params/general/citation_as_link = 'yes'">
<a href="#{/b:Citation/b:Source/b:Tag}">
<xsl:value-of select="$citation" disable-output-escaping="yes"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$citation" disable-output-escaping="yes"/>
</xsl:otherwise>
</xsl:choose>
<!-- Display the group separator if this is not the last citation. -->
<xsl:if test="not(/b:Citation/b:LastAuthor)">
<xsl:value-of select="$params/citation/separator" disable-output-
escaping="yes"/>
</xsl:if>
<!-- Display the close bracket if this is the last citation. -->
<xsl:if test="/b:Citation/b:LastAuthor">
<xsl:value-of select="$params/citation/closebracket" disable-output-
escaping="yes"/>
</xsl:if>
</p>
</body>
</html>
</xsl:template>
<html xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<p class="MsoBibliography">
<!-- Display the open bracket if this is the first citation. -->
<xsl:if test="/b:FootnoteCitation/b:FirstAuthor">
<xsl:value-of select="$params/footnotecitation/openbracket" disable-output-
escaping="yes"/>
</xsl:if>
</xsl:variable>
<!-- Extend the source. -->
<xsl:variable name="extendedSource">
<b:Source>
<xsl:copy-of select="/b:FootnoteCitation/b:Source/*"/>
<!-- For processing the \f parameter. -->
<b:FootnoteCitationPrefix>
<xsl:value-of select="/b:FootnoteCitation/b:PagePrefix"/>
</b:FootnoteCitationPrefix>
<!-- For processing the \s parameter. -->
<b:FootnoteCitationSuffix>
<xsl:value-of select="/b:FootnoteCitation/b:PageSuffix"/>
</b:FootnoteCitationSuffix>
<!-- For processing the \p parameter. -->
<b:FootnoteCitationPages>
<xsl:value-of select="/b:FootnoteCitation/b:Pages"/>
</b:FootnoteCitationPages>
<!-- For processing the \v parameter. -->
<b:FootnoteCitationVolume>
<xsl:value-of select="/b:FootnoteCitation/b:Volume"/>
</b:FootnoteCitationVolume>
</b:Source>
</xsl:variable>
<xsl:call-template name="format-source">
<xsl:with-param name="format" select="$format"/>
<xsl:with-param name="source"
select="msxsl:node-set($extendedSource)/b:Source"/>
<xsl:with-param name="disallowed">
<!-- Do not display the authors of the work. -->
<xsl:if test="/b:FootnoteCitation/b:NoAuthor">
<xsl:value-of select="msxsl:node-set($data)/citation/noauthor"/>
</xsl:if>
<!-- Do not display the title of the work. -->
<xsl:if test="/b:FootnoteCitation/b:NoTitle">
<xsl:value-of select="msxsl:node-set($data)/citation/notitle"/>
</xsl:if>
<!-- Do not display the year the work was written or accessed in. -->
<xsl:if test="/b:FootnoteCitation/b:NoYear">
<xsl:value-of select="msxsl:node-set($data)/citation/noyear"/>
</xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<!-- Display the group separator if this is not the last citation. -->
<xsl:if test="not(/b:FootnoteCitation/b:LastAuthor)">
<xsl:value-of select="$params/citation/separator" disable-output-
escaping="yes"/>
</xsl:if>
<!-- Display the close bracket if this is the last citation. -->
<xsl:if test="/b:FootnoteCitation/b:LastAuthor">
<xsl:value-of select="$params/citation/closebracket" disable-output-
escaping="yes"/>
</xsl:if>
</p>
</body>
</html>
</xsl:template>
<!-- Extends the b:Source elements of the b:Bibliography element with a b:SortKey.
-->
<xsl:variable name="extendedBib">
<!-- Create a b:Bibliography element. -->
<b:Bibliography>
<!-- Extend all the b:Source elements with a sortkey. -->
<xsl:for-each select="/b:Bibliography/b:Source">
<b:Source>
<!-- Copy the content of the b:Source. -->
<xsl:copy-of select="./*"/>
<!-- Add a sorting key. -->
<xsl:call-template name="create-sortkey">
<xsl:with-param name="source" select="."/>
</xsl:call-template>
</b:Source>
</xsl:for-each>
<!-- With the exception of the b:Source elements, copy all elements (not really
used by the stylesheets). -->
<!--<xsl:for-each select="/b:Bibliography/*">
<xsl:if test="local-name() != 'Source'">
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:if>
</xsl:for-each>-->
</b:Bibliography>
</xsl:variable>
<html xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
p.MsoBibliography
</style>
</head>
<body>
<xsl:choose>
<!-- If there is more than one column, use a table layout. -->
<xsl:when test="msxsl:node-set($data)/bibliography/columns > 1">
<xsl:call-template name="format-bibliography-as-table">
<xsl:with-param name="bibNodeSet" select="msxsl:node-set($extendedBib)"/>
</xsl:call-template>
</xsl:when>
<!-- Otherwise use a paragraph layout. -->
<xsl:otherwise>
<xsl:call-template name="format-bibliography-as-paragraphs">
<xsl:with-param name="bibNodeSet" select="msxsl:node-set($extendedBib)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
<xsl:for-each select="$bibNodeSet/b:Bibliography/b:Source">
<xsl:sort select="b:SortKey" data-type="text"/>
<p class="MsoBibliography">
<!-- Get the format string. -->
<xsl:variable name="format">
<xsl:variable name="type" select="./b:Type"/>
<xsl:variable name="sourcetype" select="./b:SourceType"/>
<xsl:choose>
<!-- If there is no source type, its a placeholder. -->
<xsl:when test="string-length($sourcetype) = 0 and string-
length(msxsl:node-set($data)/bibliography/source[@type = 'Placeholder']/column[@id =
'1']/format) > 0">
<xsl:value-of select="msxsl:node-set($data)/bibliography/source[@type =
'Placeholder']/column[@id = '1']/format"/>
</xsl:when>
<!-- Go for the type element if available. -->
<xsl:when test="string-length($type) > 0 and string-length(msxsl:node-
set($data)/bibliography/source[@type = $type]/column[@id = '1']/format) > 0 ">
<xsl:value-of select="msxsl:node-set($data)/bibliography/source[@type =
$type]/column[@id = '1']/format"/>
</xsl:when>
<!-- Else go for the source type element if available. -->
<xsl:when
test="string-length(msxsl:node-set($data)/bibliography/source[@type =
$sourcetype]/column[@id = '1']/format) > 0 ">
<xsl:value-of select="msxsl:node-set($data)/bibliography/source[@type =
$sourcetype]/column[@id = '1']/format"/>
</xsl:when>
<!-- Else display error message. -->
<xsl:otherwise>
<xsl:if test="msxsl:node-set($data)/general/display_errors = 'yes'">
<xsl:text><b>Unsupported </xsl:text>
<xsl:if test="string-length($type) > 0">
<xsl:text>type (</xsl:text>
<xsl:value-of select="$type"/>
<xsl:text>) and </xsl:text>
</xsl:if>
<xsl:text>source type (</xsl:text>
<xsl:value-of select="$sourcetype"/>
<xsl:text>) for source </xsl:text>
<xsl:value-of select="./b:Tag"/>
<xsl:text>.</b></xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:for-each>
</xsl:template>
<table width="100%">
<xsl:for-each select="$bibNodeSet/b:Bibliography/b:Source">
<xsl:sort select="b:SortKey" data-type="text"/>
<tr>
<xsl:call-template name="format-bibliography-table-column">
<xsl:with-param name="columnId" select="1"/>
<xsl:with-param name="source" select="."/>
</xsl:call-template>
</tr>
</xsl:for-each>
</table>
<!-- Empty paragraph hack for table. -->
<p class="MsoBibliography" style="display:none;"></p>
</xsl:template>
<xsl:choose>
<!-- If there is no source type, its a placeholder. -->
<xsl:when test="string-length($sourcetype) = 0 and string-length(msxsl:node-
set($data)/bibliography/source[@type = 'Placeholder']/column[@id = $columnId]/format) >
0">
<xsl:value-of select="msxsl:node-set($data)/bibliography/source[@type =
'Placeholder']/column[@id = $columnId]/format"/>
</xsl:when>
<!-- Go for the type element if available. -->
<xsl:when test="string-length($type) > 0 and string-length(msxsl:node-
set($data)/bibliography/source[@type = $type]/column[@id = $columnId]/format) > 0 ">
<xsl:value-of select="msxsl:node-set($data)/bibliography/source[@type =
$type]/column[@id = $columnId]/format"/>
</xsl:when>
<!-- Else go for the source type element if available. -->
<xsl:when test="string-length(msxsl:node-set($data)/bibliography/source[@type =
$sourcetype]/column[@id = $columnId]/format) > 0 ">
<xsl:value-of select="msxsl:node-set($data)/bibliography/source[@type =
$sourcetype]/column[@id = $columnId]/format"/>
</xsl:when>
<!-- Else display error message. -->
<xsl:otherwise>
<xsl:if test="msxsl:node-set($data)/general/display_errors = 'yes'">
<xsl:text><b>Unsupported </xsl:text>
<xsl:if test="string-length($type) > 0">
<xsl:text>type (</xsl:text>
<xsl:value-of select="$type"/>
<xsl:text>) and </xsl:text>
</xsl:if>
<xsl:text>source type (</xsl:text>
<xsl:value-of select="$sourcetype"/>
<xsl:text>) for source </xsl:text>
<xsl:value-of select="./b:Tag"/>
<xsl:text>.</b></xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Not really efficient at the moment, but it does the trick so errors can be
displayed. -->
<xsl:variable name="type">
<xsl:variable name="temp" select="$source/b:Type"/>
<xsl:variable name="temp2" select="$source/b:SourceType"/>
<xsl:choose>
<xsl:when test="string-length($temp2) = 0 and string-length(msxsl:node-
set($data)/bibliography/source[@type = $temp2]/column[@id = $columnId]/format) > 0 ">
<xsl:value-of select="'Placeholder'"/>
</xsl:when>
<xsl:when test="string-length($temp) > 0 and string-length(msxsl:node-
set($data)/bibliography/source[@type = $temp]/column[@id = $columnId]/format) > 0 ">
<xsl:value-of select="$temp"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$source/b:SourceType"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="columnX">
<xsl:call-template name="format-source">
<xsl:with-param name="format" select="$format"/>
<xsl:with-param name="source" select="$source"/>
</xsl:call-template>
</xsl:variable>
<!-- Adds balanced brackets around the entire string to help others. -->
<xsl:text>{0}</xsl:text>
<xsl:call-template name="preprocess-format-string-part-2">
<xsl:with-param name="string" select="$string"/>
</xsl:call-template>
<!-- Adds balanced brackets around the entire string to help others. -->
<xsl:text>{0}</xsl:text>
</xsl:template>
<xsl:choose>
<!-- A new level is reached. -->
<xsl:when test="$firstChar = '{'">
<!-- Calculate the next level. -->
<xsl:variable name="nextLevel" select="$level + 1"/>
<xsl:call-template name="clean-punctuation">
<xsl:with-param name="string">
<xsl:call-template name="format-source-part-2">
<xsl:with-param name="source" select="$source"/>
<xsl:with-param name="format">
<xsl:call-template name="preprocess-format-string">
<xsl:with-param name="string" select="$format"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="used" select="$disallowed"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:choose>
<!-- Check if there is still conditional processing to do. -->
<xsl:when test="contains($format, '{')">
<!-- Get the first level to process. -->
<xsl:variable name="level" select="substring-before(substring-after($format,
'{'), '}')"/>
<xsl:variable name="current">
<xsl:call-template name="format-source-part-3">
<!-- The current source. -->
<xsl:with-param name="source" select="$source"/>
<!-- Retrieve the part that has to be processed during this run. -->
<xsl:with-param name="format" select="substring-before(substring-
after($format, $delim), $delim)"/>
<!-- List of variables which can no longer be used. -->
<xsl:with-param name="used" select="$used"/>
<!-- Level of variables to process during this run. -->
<xsl:with-param name="level" select="$level"/>
</xsl:call-template>
</xsl:variable>
<!-- Part before the part that was processed in this run. -->
<xsl:value-of select="substring-before($format, $delim)"/>
</xsl:when>
<!-- Otherwise, print the entire leftover string. -->
<xsl:otherwise>
<xsl:value-of select="$format"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Helper function for format-source-part-2. This function recursively
resolves the variables at the current level.
-->
<xsl:template name="format-source-part-3">
<!-- The b:Source element to format. -->
<xsl:param name="source"/>
<!-- The preprocessed format in which to display the b:Source element. -->
<xsl:param name="format"/>
<!-- b:Source child elements which can not be used (-name1-name2-). -->
<xsl:param name="used"/>
<!-- Level of variables to process. -->
<xsl:param name="level"/>
<!-- Output so far for this part. -->
<xsl:param name="outputAtCurrentLevel" select="''"/>
<!-- b:Source child elements which can not be used because they are
already used at this level. They are an extension to 'used'. -->
<xsl:param name="usedAtCurrentLevel" select="''"/>
<xsl:choose>
<!-- Check if further processing has to be done. -->
<xsl:when test="string-length($format) > 0">
<!-- Get the delimeter for the current level of parameters to process. -->
<xsl:variable name="delim" select="concat('%', $level, '%')"/>
<xsl:choose>
<!-- Check if there are variables left at the current level to process. -->
<xsl:when test="contains($format, $delim)">
<!-- Get the name of the first available element in the first parameter
part. -->
<xsl:variable name="name">
<xsl:call-template name="get-source-parameter">
<xsl:with-param name="parameters" select="substring-before(substring-
after($format, $delim), $delim)"/>
<xsl:with-param name="source" select="$source"/>
<xsl:with-param name="used" select="concat($used,
$usedAtCurrentLevel)"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="result">
<xsl:if test="string-length($name) > 0">
<!-- Get the formatting options for the element. -->
<xsl:variable name="options">
<xsl:call-template name="substring-before-ex">
<xsl:with-param name="string" select="substring-after(substring-
before(substring-after($format, $delim), $delim), concat($name, ':'))"/>
<xsl:with-param name="delimeter" select="'|'"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<!-- Handle "or" strings in format; e.g.: {%Year|"n.d."%} -->
<xsl:when test="starts-with($name, '"') and substring($name,
string-length($name), 1) = '"'">
<xsl:value-of select="substring-before(substring-after($name,
'"'), '"')"/>
</xsl:when>
<!-- Handle non-empty author parameters. -->
<xsl:when test="string($source/b:Author/*[local-name() = $name])">
<!-- Remove non-numeric characters from the options section (mostly
for the r option). -->
<xsl:variable name="options2" select="translate($options,
translate($options, '0123456789', ''), '')"/>
<xsl:choose>
<!-- Handle contributors of which the format is specified. -->
<xsl:when test="string-length($options2) > 0">
<xsl:call-template name="format-contributors-by-params">
<xsl:with-param name="contributors"
select="$source/b:Author/*[local-name() = $name]"/>
<xsl:with-param name="params"
select="msxsl:node-set($data)/namelists/list[@id = $options2]"/>
</xsl:call-template>
</xsl:when>
<!-- Handle contributor counting. -->
<xsl:when test="translate($options, translate($options, 'c', ''),
'') = 'c'">
<xsl:call-template name="count-contributors">
<xsl:with-param name="contributors"
select="$source/b:Author/*[local-name() = $name]"/>
</xsl:call-template>
</xsl:when>
<!-- Handle contributors of which the format is not specified. --
>
<xsl:otherwise>
<xsl:call-template name="format-contributors-by-params">
<xsl:with-param name="contributors"
select="$source/b:Author/*[local-name() = $name]"/>
<xsl:with-param name="params"
select="msxsl:node-set($data)/namelists/list[@id = 0]"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Handle pages. -->
<xsl:when test="$name = 'Pages' and string($source/b:Pages)">
<xsl:call-template name="format-pages">
<xsl:with-param name="pages" select="$source/b:Pages"/>
<xsl:with-param name="options" select="$options"/>
</xsl:call-template>
</xsl:when>
<!-- Handle cited pages. -->
<xsl:when test="$name = 'CitationPages' and
string($source/b:CitationPages)">
<xsl:call-template name="format-pages">
<xsl:with-param name="pages" select="$source/b:CitationPages"/>
<xsl:with-param name="options" select="$options"/>
</xsl:call-template>
</xsl:when>
<!-- Handle URLs. -->
<xsl:when test="$name = 'URL' and string($source/b:URL)">
<xsl:call-template name="format-url">
<xsl:with-param name="url" select="$source/b:URL"/>
<xsl:with-param name="options" select="$options"/>
</xsl:call-template>
</xsl:when>
<!-- Handle years and years accessed. -->
<xsl:when test="starts-with($name, 'Year') and
string($source/*[local-name() = $name])">
<xsl:call-template name="format-year">
<xsl:with-param name="year" select="$source/*[local-name() =
$name]"/>
<xsl:with-param name="options" select="$options"/>
</xsl:call-template>
</xsl:when>
<!-- Handle days and days accessed. -->
<xsl:when test="starts-with($name, 'Day') and string($source/*[local-
name() = $name])">
<xsl:call-template name="format-day">
<xsl:with-param name="day" select="$source/*[local-name() =
$name]"/>
<xsl:with-param name="options" select="$options"/>
</xsl:call-template>
</xsl:when>
<!-- Handle titles. -->
<xsl:when test="contains($name, 'Title') and string($source/*[local-
name() = $name])">
<!-- Format the title. -->
<xsl:variable name="title">
<xsl:call-template name="format-title">
<xsl:with-param name="title" select="$source/*[local-name() =
$name]"/>
<xsl:with-param name="options" select="$options"/>
<xsl:with-param name="delimeter">
<xsl:choose>
<xsl:when
test="string-length(msxsl:node-set($data)/overrides/titles/delimeter) > 0">
<xsl:value-of
select="msxsl:node-set($data)/overrides/titles/delimeter"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>:</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="articles">
<xsl:choose>
<xsl:when
test="string-length(msxsl:node-set($data)/overrides/titles/articles) > 0">
<xsl:value-of
select="msxsl:node-set($data)/overrides/titles/articles"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>-A-AN-THE-</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<!-- Display the title or %empty% if the title is empty. -->
<xsl:choose>
<xsl:when test="string-length($title) = 0">
<xsl:text>%empty%</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$title"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Handle edition. -->
<xsl:when test="$name = 'Edition' and string($source/b:Edition)">
<xsl:choose>
<xsl:when test="contains($options, 'u')">
<xsl:call-template name="upper-case">
<xsl:with-param name ="string">
<xsl:choose>
<xsl:when test="contains($options, 'o')">
<xsl:call-template name="format-ordinal">
<xsl:with-param name="number"
select="$source/b:Edition"/>
<xsl:with-param name="options" select="$options"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$source/b:Edition"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($options, 'l')">
<xsl:call-template name="lower-case">
<xsl:with-param name ="string">
<xsl:choose>
<xsl:when test="contains($options, 'o')">
<xsl:call-template name="format-ordinal">
<xsl:with-param name="number"
select="$source/b:Edition"/>
<xsl:with-param name="options" select="$options"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$source/b:Edition"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="contains($options, 'o')">
<xsl:call-template name="format-ordinal">
<xsl:with-param name="number"
select="$source/b:Edition"/>
<xsl:with-param name="options" select="$options"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$source/b:Edition"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Handle volume and citation volume. -->
<xsl:when test="($name = 'Volume' or $name = 'CitationVolume') and
string($source/*[local-name() = $name]) and number($source/*[local-name() = $name]) >
0">
<xsl:call-template name="format-number">
<xsl:with-param name="number" select="$source/*[local-name() =
$name]"/>
<xsl:with-param name="options" select="translate($options,
translate($options, 'R', ''), '')"/>
</xsl:call-template>
</xsl:when>
<!-- Handle months and months accessed. -->
<xsl:when test="starts-with($name, 'Month') and
string($source/*[local-name() = $name])">
<xsl:call-template name="format-month">
<xsl:with-param name="month" select="$source/*[local-name() =
$name]"/>
<xsl:with-param name="options" select="$options"/>
</xsl:call-template>
</xsl:when>
<!-- Handle source types. -->
<xsl:when test="$name = 'SourceType' and
string($source/b:SourceType)">
<xsl:call-template name="format-sourcetype">
<xsl:with-param name="type" select="$source/b:SourceType"/>
<xsl:with-param name="options" select="$options"/>
</xsl:call-template>
</xsl:when>
<!-- Handle all other non-empty, non-author parameters. -->
<xsl:when test="string($source/*[local-name() = $name])">
<xsl:choose>
<xsl:when test="contains($options, 'u')">
<xsl:call-template name="upper-case">
<xsl:with-param name ="string" select="$source/*[local-name()
= $name]"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($options, 'l')">
<xsl:call-template name="lower-case">
<xsl:with-param name ="string" select="$source/*[local-name()
= $name]"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$source/*[local-name() = $name]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:if>
<!-- Mark the element as being empty. -->
<xsl:if test="string-length($name) = 0">
<xsl:text>%empty%</xsl:text>
</xsl:if>
</xsl:variable>
</xsl:when>
<!-- Otherwise, finish the output of the function. -->
<xsl:otherwise>
<xsl:choose>
<!-- Check if anything has to be send to the output and if the used variables
section has to be updated. -->
<xsl:when test="not(contains($outputAtCurrentLevel, '%empty%')) and string-
length($outputAtCurrentLevel) > 0">
<output>
<xsl:value-of select="$outputAtCurrentLevel"/>
</output>
<used>
<xsl:value-of select="$usedAtCurrentLevel"/>
</used>
</xsl:when>
<!-- Otherwise, nothing has to be send to the output. The used variables stay
used. -->
<xsl:otherwise>
<output></output>
<used></used>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Retrieves the first non empty source parameter name. -->
<xsl:template name="get-source-parameter">
<!-- A string with one or more parameters separated by '|'. -->
<xsl:param name="parameters"/>
<!-- The b:Source element. -->
<xsl:param name="source"/>
<!-- A string with no longer available child elements of the b:Source element (-
name1-name2). -->
<xsl:param name="used"/>
</xsl:template>
<xsl:call-template name="format-person-part-2">
<xsl:with-param name="person" select="$person"/>
<xsl:with-param name="format">
<xsl:call-template name="preprocess-format-string">
<xsl:with-param name="string" select="$format"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:variable name="current">
<xsl:call-template name="format-person-part-3">
<!-- The current source. -->
<xsl:with-param name="person" select="$person"/>
<!-- Retrieve the part that has to be processed during this run. -->
<xsl:with-param name="format" select="substring-before(substring-
after($format, $delim), $delim)"/>
<!-- List of variables which can no longer be used. -->
<xsl:with-param name="used" select="$used"/>
<!-- Level of variables to process during this run. -->
<xsl:with-param name="level" select="$level"/>
</xsl:call-template>
</xsl:variable>
<!-- Part before the part that was processed in this run. -->
<xsl:value-of select="substring-before($format, $delim)"/>
</xsl:when>
<!-- Otherwise, print the entire leftover string. -->
<xsl:otherwise>
<xsl:value-of select="$format"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:choose>
<!-- Check if further processing has to be done. -->
<xsl:when test="string-length($format) > 0">
<!-- Get the delimeter for the current level of parameters to process. -->
<xsl:variable name="delim" select="concat('%', $level, '%')"/>
<xsl:choose>
<!-- Check if there are variables left at the current level to process. -->
<xsl:when test="contains($format, $delim)">
<!-- Get the name of the first available element in the first parameter
part. -->
<xsl:variable name="name">
<xsl:call-template name="get-person-parameter">
<xsl:with-param name="parameters" select="substring-before(substring-
after($format, $delim), $delim)"/>
<xsl:with-param name="person" select="$person"/>
<xsl:with-param name="used" select="concat($used,
$usedAtCurrentLevel)"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="result">
<xsl:if test="string-length($name) > 0">
<!-- Get the formatting options for the element. -->
<xsl:variable name="options">
<xsl:call-template name="substring-before-ex">
<xsl:with-param name="string" select="substring-after(substring-
before(substring-after($format, $delim), $delim), concat($name, ':'))"/>
<xsl:with-param name="delimeter" select="'|'"/>
</xsl:call-template>
</xsl:variable>
</xsl:if>
<!-- Mark the element as being empty. -->
<xsl:if test="string-length($name) = 0">
<xsl:text>%empty%</xsl:text>
</xsl:if>
</xsl:variable>
</xsl:when>
<!-- Otherwise, finish the output of the function. -->
<xsl:otherwise>
<xsl:choose>
<!-- Check if anything has to be send to the output and if the used variables
section has to be updated. -->
<xsl:when test="not(contains($outputAtCurrentLevel, '%empty%')) and string-
length($outputAtCurrentLevel) > 0">
<output>
<xsl:value-of select="$outputAtCurrentLevel"/>
</output>
<used>
<xsl:value-of select="$usedAtCurrentLevel"/>
</used>
</xsl:when>
<!-- Otherwise, nothing has to be send to the output. The used variables stay
used. -->
<xsl:otherwise>
<output></output>
<used></used>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Retrieves the first non empty person parameter name. -->
<xsl:template name="get-person-parameter">
<!-- A string with one or more parameters separated by '|'. -->
<xsl:param name="parameters"/>
<!-- The b:Person element. -->
<xsl:param name="person"/>
<!-- A string with no longer available child elements of the b:Person element (-
name1-name2). -->
<xsl:param name="used"/>
</xsl:if>
</xsl:template>
<xsl:variable name="temp">
<!-- Temporarely variable. -->
<xsl:variable name="remainder" select="substring-after($format, '%')"/>
</xsl:template>
<!-- Formats a set of contributors by means of parameters. -->
<xsl:template name="format-contributors-by-params">
<!-- A set containing either a b:Corporate or a b:NameList element. -->
<xsl:param name="contributors" />
<!-- An XML tree containing formatting information, the following
elements should be provided:
<format type="...">
<single_prefix></single_prefix>
<multi_prefix></multi_prefix>
<corporate></corporate>
<first_person></first_person>
<other_persons></other_persons>
<separator_between_if_two></separator_between_if_two>
<separator_between_if_more_than_two></separator_between_if_more_than_two>
<separator_before_last></separator_before_last>
<max_number_of_persons_to_display></max_number_of_persons_to_display>
<number_of_persons_to_display_if_more_than_max></number_of_persons_to_display_if_more_t
han_max>
<overflow></overflow>
<single_suffix></single_suffix>
<multi_suffix></multi_suffix>
</format>
-->
<xsl:param name="params" />
<xsl:choose>
<!-- b:Corporate contributor. -->
<xsl:when test="string-length($contributors/b:Corporate) > 0">
<!-- Display the single prefix. -->
<xsl:value-of select="$params/single_prefix"/>
<xsl:choose>
<xsl:when test="position() > $numDisplay"/>
<xsl:when test="position() = 1">
<xsl:call-template name="format-person">
<xsl:with-param name="person" select="." />
<xsl:with-param name="format" select="$params/first_person" />
</xsl:call-template>
</xsl:when>
<xsl:when test="position() = 2 and $numPersons = 2">
<xsl:value-of select="$params/separator_between_if_two"/>
<xsl:call-template name="format-person">
<xsl:with-param name="person" select="." />
<xsl:with-param name="format" select="$params/other_persons" />
</xsl:call-template>
</xsl:when>
<xsl:when test="(position() = $numDisplay) and not($numPersons >
$numDisplay)">
<xsl:value-of select="$params/separator_before_last"/>
<xsl:call-template name="format-person">
<xsl:with-param name="person" select="." />
<xsl:with-param name="format" select="$params/other_persons" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$params/separator_between_if_more_than_two"/>
<xsl:call-template name="format-person">
<xsl:with-param name="person" select="." />
<xsl:with-param name="format" select="$params/other_persons" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:choose>
<!-- Handle 'A-B' -->
<xsl:when test="contains($name, '-')">
<xsl:call-template name="abbreviate-name">
<xsl:with-param name="name" select="substring-before(normalize-space($name),
'-')"/>
<xsl:with-param name="withPeriods" select="$withPeriods"/>
<xsl:with-param name="keepSpaces" select="$keepSpaces"/>
<xsl:with-param name="keepDashes" select="$keepDashes"/>
</xsl:call-template>
<xsl:if test="$keepDashes = 1">
<xsl:text>-</xsl:text>
</xsl:if>
<xsl:call-template name="abbreviate-name">
<xsl:with-param name="name" select="substring-after(normalize-space($name),
'-')"/>
<xsl:with-param name="withPeriods" select="$withPeriods"/>
<xsl:with-param name="keepSpaces" select="$keepSpaces"/>
<xsl:with-param name="keepDashes" select="$keepDashes"/>
</xsl:call-template>
</xsl:when>
<!-- Handle 'A B' -->
<xsl:when test="contains($name, ' ')">
<xsl:call-template name="abbreviate-name">
<xsl:with-param name="name" select="substring-before(normalize-space($name),
' ')"/>
<xsl:with-param name="withPeriods" select="$withPeriods"/>
<xsl:with-param name="keepSpaces" select="$keepSpaces"/>
<xsl:with-param name="keepDashes" select="$keepDashes"/>
</xsl:call-template>
<xsl:if test="$keepSpaces = 1">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:call-template name="abbreviate-name">
<xsl:with-param name="name" select="substring-after(normalize-space($name), '
')"/>
<xsl:with-param name="withPeriods" select="$withPeriods"/>
<xsl:with-param name="keepSpaces" select="$keepSpaces"/>
<xsl:with-param name="keepDashes" select="$keepDashes"/>
</xsl:call-template>
</xsl:when>
<!-- Handle 'A.B.'-->
<xsl:when test="contains($name, '.') and string-length(substring-after($name,
'.')) > 0">
<xsl:call-template name="abbreviate-name">
<xsl:with-param name="name" select="substring-before(normalize-space($name),
'.')"/>
<xsl:with-param name="withPeriods" select="$withPeriods"/>
<xsl:with-param name="keepSpaces" select="$keepSpaces"/>
<xsl:with-param name="keepDashes" select="$keepDashes"/>
</xsl:call-template>
<xsl:if test="$keepSpaces = 1">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:call-template name="abbreviate-name">
<xsl:with-param name="name" select="substring-after(normalize-space($name),
'.')"/>
<xsl:with-param name="withPeriods" select="$withPeriods"/>
<xsl:with-param name="keepSpaces" select="$keepSpaces"/>
<xsl:with-param name="keepDashes" select="$keepDashes"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:if test="string-length($name) > 0">
<xsl:value-of select="substring($name,1,1)"/>
<xsl:if test="$withPeriods = 1">
<xsl:text>.</xsl:text>
</xsl:if>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:choose>
<!-- b:Corporate contributor. -->
<xsl:when test="string-length($contributors/b:Corporate) > 0">
<xsl:text>1</xsl:text>
</xsl:when>
<!-- b:NameList contributor(s). -->
<xsl:when test="string-length($contributors/b:NameList) > 0">
<xsl:value-of select="count($contributors/b:NameList/b:Person)" />
</xsl:when>
<!-- Empty element. -->
<xsl:otherwise>
<xsl:text>0</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:template>
<!-- Adds zero-width spaces to a string to allow splitting long strings over multiple
lines. -->
<xsl:template name="add-zwsp">
<!-- The (partial) string to add zero-width spaces to. -->
<xsl:param name="string"/>
<!-- Characters (not a string) to add a zero-width space after. If empty, one is
added after each character. -->
<xsl:param name="afterChars"/>
<xsl:choose>
<!-- Only check to add a zwsp if there is more than one character left. -->
<xsl:when test="string-length($string) > 1">
<!-- Display first character of string. -->
<xsl:value-of select="substring($string, 1, 1)"/>
<!-- Add zwsp if required. -->
<xsl:if test="string-length($afterChars) = 0 or contains($afterChars,
substring($string, 1, 1))">
<xsl:value-of select="'​'"/>
</xsl:if>
<!-- Process the remainder of the string. -->
<xsl:call-template name="add-zwsp">
<xsl:with-param name="string" select="substring($string, 2)"/>
<xsl:with-param name="afterChars" select="$afterChars"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:choose>
<xsl:when test="contains($options, 's')">
<xsl:value-of select="substring($year, 2, 2)"/>
</xsl:when>
<xsl:when test="contains($options, 'i')">
<xsl:value-of select="9999 - $year"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$year"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:template>
<!-- A list with all possible multi page separators. (e.g. dash, en-dash,
colon, ...) -->
<!-- This should be retrieved from a setting element in the data variable. -->
<xsl:variable name="multiPageSeparators">
<xsl:value-of
select="'-:‐‑‒–舐舑'"/>
</xsl:variable>
</xsl:template>
<!-- Abbreviates a range of page numbers. (e.g. 315-317 becomes 315-7) -->
<xsl:template name="abbreviate-pages">
<!-- A range of pages with either '-' or ':' as a separator. -->
<xsl:param name="pages"/>
<!-- Minimum size of the last part. (e.g.: 2 -> 315-317 becomes 315-17) -->
<xsl:param name="size" select="'0'"/>
<!-- The multi page separator. -->
<xsl:param name="separator"/>
<xsl:choose>
<!-- Only try to abbreviate if there is a separator. -->
<xsl:when test="string-length($separator) > 0">
<xsl:call-template name="abbreviate-pages-part-2">
<xsl:with-param name="firstPage" select="substring-before($pages,
$separator)"/>
<xsl:with-param name="lastPage" select="substring-after($pages,
$separator)"/>
<xsl:with-param name="separator" select="$separator"/>
<xsl:with-param name="size" select="$size"/>
</xsl:call-template>
</xsl:when>
<!-- There is no separator, just return everything. -->
<xsl:otherwise>
<xsl:value-of select="$pages"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:choose>
<xsl:when test="string-length($firstPage) != string-length($lastPage)">
<!-- If both page numbers do not contain the same amount of numbers, there is
no point in continuing. -->
<!-- Note that this check should only happen once and could be optimized if
required. -->
<xsl:value-of select="$firstPage"/>
<xsl:value-of select="$separator"/>
<xsl:value-of select="$lastPage"/>
</xsl:when>
<xsl:when test="substring($firstPage, $position, 1) = substring($lastPage,
$position, 1) and string-length(substring($lastPage, $position)) > $size">
<!-- Recursive repeat until the first non-matching number is found or the
remainder gets too short. -->
<xsl:call-template name="abbreviate-pages-part-2">
<xsl:with-param name="firstPage" select="$firstPage"/>
<xsl:with-param name="lastPage" select="$lastPage"/>
<xsl:with-param name="separator" select="$separator"/>
<xsl:with-param name="position" select="$position + 1"/>
<xsl:with-param name="size" select="$size"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- The shortest version was found, display it. -->
<xsl:value-of select="$firstPage"/>
<xsl:value-of select="$separator"/>
<xsl:value-of select="substring($lastPage, $position)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Extends a range of page numbers. (e.g. 315-7 becomes 315-317). -->
<xsl:template name="extend-pages">
<!-- A range of pages with either '-' or ':' as a separator. -->
<xsl:param name="pages"/>
<!-- The multi page separator. -->
<xsl:param name="separator"/>
<xsl:choose>
<!-- Only try to extend if there is a separator. -->
<xsl:when test="string-length($separator) > 0">
<xsl:variable name="firstPage" select="substring-before($pages, $separator)"/>
<xsl:variable name="lastPage" select="substring-after($pages, $separator)"/>
<!-- Gets the first page of a range of page numbers. (e.g. 315-317 becomes 315) -->
<xsl:template name="first-page">
<!-- A range of pages. -->
<xsl:param name="pages"/>
<!-- A possible separator (if empty, ':' or '-' will be used. -->
<xsl:param name="separator"/>
<xsl:choose>
<xsl:when test="string-length($separator) > 0">
<xsl:value-of select="substring-before($pages, $separator)"/>
</xsl:when>
<xsl:when test="contains($pages, ':')">
<xsl:value-of select="substring-before($pages, ':')"/>
</xsl:when>
<xsl:when test="contains($pages, '-')">
<xsl:value-of select="substring-before($pages, '-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$pages"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:choose>
<xsl:when test="contains($options, 'r')">
<xsl:number value="$number" format="i"/>
</xsl:when>
<xsl:when test="contains($options, 'R')">
<xsl:number value="$number" format="I"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$number"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:choose>
<!-- If a number is available, format it. -->
<xsl:when test="string-length($asNumber) > 0">
<!-- Display the number. -->
<xsl:call-template name="format-number">
<xsl:with-param name="number" select="$asNumber"/>
<xsl:with-param name="options" select="translate($options,
translate($options, 'R', ''), '')"/>
</xsl:call-template>
</xsl:template>
</xsl:template>
</xsl:template>
<!-- Check if the number should be in uppercase or lowercase (only useful when
represented as an ordinal). -->
<xsl:variable name="temp3">
<xsl:choose>
<xsl:when test="contains($options, 'u')">
<xsl:call-template name="upper-case">
<xsl:with-param name="string" select="$temp2"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($options, 'l')">
<xsl:call-template name="lower-case">
<xsl:with-param name="string" select="$temp2"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$temp2"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$temp3"/>
</xsl:template>
<!-- Select the requested title part (main, sub, or full). -->
<xsl:variable name="part">
<xsl:choose>
<!-- Main title part (or full title if there is no subtitle).-->
<xsl:when test="contains($options, 'm')">
<xsl:variable name="temp">
<xsl:call-template name="substring-before-ex">
<xsl:with-param name="string" select="$title"/>
<xsl:with-param name="delimeter" select="$delimeter"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="normalize-space($temp)"/>
</xsl:when>
<!-- Subtitle. Can be empty if there is none. -->
<xsl:when test="contains($options, 's')">
<xsl:value-of select="normalize-space(substring-after($title, $delimeter))"/>
</xsl:when>
<!-- Full title. -->
<xsl:otherwise>
<xsl:value-of select="$title"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- If necessary, transform the title part to work for sorting. -->
<xsl:variable name="sort">
<xsl:choose>
<xsl:when test="contains($options, 'a')">
<!-- Get the first word. -->
<xsl:variable name="temp1">
<xsl:call-template name="substring-before-ex">
<xsl:with-param name="string" select="$title"/>
<xsl:with-param name="delimeter" select="$delimeter"/>
</xsl:call-template>
</xsl:variable>
<!-- Capitalize the possible start words to put at the end. -->
<xsl:variable name="firstWords">
<xsl:call-template name="upper-case">
<xsl:with-param name="string" select="$articles"/>
</xsl:call-template>
</xsl:variable>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$part"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Apply the correct casing to the requested title part. -->
<xsl:variable name="casing">
<xsl:choose>
<!-- Entire title in upper case. -->
<xsl:when test="contains($options, 'u')">
<xsl:call-template name="upper-case">
<xsl:with-param name="string" select="$sort"/>
</xsl:call-template>
</xsl:when>
<!-- Entire title in lower case. -->
<xsl:when test="contains($options, 'l')">
<xsl:call-template name="lower-case">
<xsl:with-param name="string" select="$sort"/>
</xsl:call-template>
</xsl:when>
<!-- The first word in upper case. -->
<xsl:when test="contains($options, 'f')">
<!-- First word. -->
<xsl:call-template name="upper-case">
<xsl:with-param name="string">
<!-- Get the first word (even if there is only one word.) -->
<xsl:call-template name="substring-before-ex">
<xsl:with-param name="string" select="$sort"/>
<xsl:with-param name="delimeter" select="' '"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
<!-- Space. -->
<xsl:text> </xsl:text>
<!-- Other words. -->
<xsl:value-of select="substring-after($part, ' ')"/>
</xsl:when>
<!-- Do not adjust casing. -->
<xsl:otherwise>
<xsl:value-of select="$sort"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:template>
<!-- First part of the cleaning functionality, used to remove leading punctuation.
-->
</xsl:template>
<!-- Second part of the cleaning functionality, used to solve any non-leading
punctuation. -->
<xsl:choose>
<xsl:when test="string-length($string) > 0">
<xsl:choose>
<!-- Handle punctuation. -->
<xsl:when test="contains('!?.,;: ', substring($string, 1, 1))">
<xsl:choose>
<!-- If there was previous punctuation, handle possible cleaning. -->
<xsl:when test="$punctuation != ''">
<xsl:choose>
<!-- When the last two punctuations are equal, get rid of one. -->
<xsl:when test="$punctuation = substring($string, 1, 1)">
<xsl:call-template name="clean-punctuation-2">
<xsl:with-param name="string" select="substring($string, 2)"/>
<xsl:with-param name="punctuation" select="$punctuation"/>
<xsl:with-param name="tagbuffer" select="$tagbuffer"/>
</xsl:call-template>
</xsl:when>
<!-- Handle punctuations followed by a period. -->
<xsl:when test="contains(' ,;:.', $punctuation) and
substring($string, 1, 1) = '.'">
<xsl:value-of select="$tagbuffer"/>
<xsl:call-template name="clean-punctuation-2">
<xsl:with-param name="string" select="substring($string, 2)"/>
<xsl:with-param name="punctuation" select="'.'"/>
</xsl:call-template>
</xsl:when>
<!-- Handle punctuations with question marks and exclamation marks.
-->
<xsl:when test="contains('!?', $punctuation) and contains('!?.',
substring($string, 1, 1))">
<xsl:value-of select="$punctuation"/>
<xsl:value-of select="$tagbuffer"/>
<xsl:call-template name="clean-punctuation-2">
<xsl:with-param name="string" select="substring($string, 2)"/>
</xsl:call-template>
</xsl:when>
<!-- Non supported punctuation handling. Just display the result. -->
<xsl:otherwise>
<xsl:value-of select="$punctuation"/>
<xsl:value-of select="$tagbuffer"/>
<xsl:call-template name="clean-punctuation-2">
<xsl:with-param name="string" select="substring($string, 2)"/>
<xsl:with-param name="punctuation" select="substring($string, 1,
1)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Otherwise, there was no previous punctuation. -->
<xsl:otherwise>
<xsl:value-of select="$tagbuffer"/>
<xsl:call-template name="clean-punctuation-2">
<xsl:with-param name="string" select="substring($string, 2)"/>
<xsl:with-param name="punctuation" select="substring($string, 1,
1)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Handle tags. -->
<xsl:when test="substring($string, 1, 1) = '<'">
<xsl:call-template name="clean-punctuation-2">
<xsl:with-param name="string" select="substring-after($string, '>')"/>
<xsl:with-param name="punctuation" select="$punctuation"/>
<xsl:with-param name="tagbuffer" select="concat($tagbuffer, substring-
before($string, '>'), '>')"/>
</xsl:call-template>
</xsl:when>
<!-- Handle quotes. -->
<xsl:when test="substring($string, 1, 1) = '"'">
<xsl:call-template name="clean-punctuation-2">
<xsl:with-param name="string" select="substring($string, 2)"/>
<xsl:with-param name="punctuation" select="$punctuation"/>
<xsl:with-param name="tagbuffer" select="concat($tagbuffer, '"')"/>
</xsl:call-template>
</xsl:when>
<!-- Handle remainder of the string. -->
<xsl:otherwise>
<xsl:value-of select="$punctuation"/>
<xsl:value-of select="$tagbuffer"/>
<xsl:value-of select="substring($string, 1, 1)"/>
<xsl:call-template name="clean-punctuation-2">
<xsl:with-param name="string" select="substring($string, 2)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- End of the cleaning operation. -->
<xsl:otherwise>
<xsl:value-of select="$punctuation"/>
<xsl:value-of select="$tagbuffer"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- The set of lower case characters used to do case conversions. -->
<xsl:variable name="lowercase"
select="'abcdefghijklmnopqrstuvwxyzàáâãäåæç
2;éêëìíîïñòóôõöù&
#250;ûü'"/>
<!-- The set of upper case characters used to do case conversions. -->
<xsl:variable name="uppercase"
select="'ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇ
0;ÉÊËÌÍÎÏÑÒÓÔÕÖÙ&
#218;ÛÜ'"/>
<!-- The set of punctuation characters used as word delimeters in a string. -->
<xsl:variable name="punctuation" select="'	   .,:;!?
"‘’‚“”„«»()[]<>{}'"/>
<!--
Word 2007 does not handle text-transform when importing html.
A text-transform element set to uppercase works but it is not
supported.
-->
<xsl:choose>
<xsl:when test="contains($string, $delimeter)">
<xsl:value-of select="substring-before($string, $delimeter)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Retrieves the substring of a string after the last occurence of a symbol. -->
<xsl:template name="substring-after-last">
<!-- String to find the substring in. -->
<xsl:param name="string"/>
<!-- Separator symbol. -->
<xsl:param name="symbol"/>
<xsl:choose>
<!-- If the string contains the symbol... -->
<xsl:when test="contains($string, $symbol)">
<!-- .. call the template recursively... -->
<xsl:call-template name="substring-after-last">
<!-- ... with the string being the string after the symbol ... -->
<xsl:with-param name="string" select="substring-after($string, $symbol)"/>
<!-- ... and the symbol being the same as before. -->
<xsl:with-param name="symbol" select="$symbol"/>
</xsl:call-template>
</xsl:when>
<!-- Otherwise, return the value of the string. -->
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Retrieves the substring of a string before the last occurence of a symbol. -->
<xsl:template name="substring-before-last">
<!-- String to find the substring in. -->
<xsl:param name="string"/>
<!-- Separator symbol. -->
<xsl:param name="symbol"/>
<!-- If the symbol occurs another time in the string ... -->
<xsl:if test="contains($temp, $symbol)">
<!-- ... display the symbol ... -->
<xsl:copy-of select="$symbol"/>
</xsl:template>
<!-- Extends the b:Source elements to apply the BibWord extensions. -->
<xsl:variable name="extended">
</b:Source>
</xsl:for-each>
</b:BibWord>
</xsl:variable>
<b:Source>
<!-- Copy all elements. -->
<xsl:for-each select="./*">
<xsl:copy-of select="."/>
</xsl:for-each>
</b:Source>
</xsl:for-each>
</b:BibWord>
</xsl:variable>
<b:Source>
<!-- Copy all elements. -->
<xsl:for-each select="./*">
<xsl:copy-of select="."/>
</xsl:for-each>
</b:Source>
</xsl:for-each>
</b:BibWord>
</xsl:variable>
<b:Source>
<!-- Copy all elements except for YSReq and SortKey. -->
<xsl:for-each select="./*">
<xsl:if test="local-name() != 'YSReq' and local-name() != 'SortKey'">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
<!-- Add the YearSuffix element. -->
<b:YearSuffix>
<xsl:variable name="current" select="./b:YSReq"/>
<xsl:variable name="previous"
select="preceding-sibling::b:Source[1]/b:YSReq"/>
<xsl:variable name="next" select="following-sibling::b:Source[1]/b:YSReq"/>
<xsl:choose>
<!-- Continuation of a series. -->
<xsl:when test="position() > 1 and $current = $previous">
<xsl:call-template name="get-year-suffix">
<xsl:with-param name="index" select="position()"/>
<xsl:with-param name="bibWord" select="$sortedForYearSuffix"/>
</xsl:call-template>
</xsl:when>
<!-- First in a series. -->
<xsl:when test="last() > position() and $current = $next">
<xsl:text>a</xsl:text>
</xsl:when>
<!-- Not part of a series, the element is empty. -->
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</b:YearSuffix>
</b:Source>
</xsl:for-each>
</b:BibWord>
</xsl:template>
</xsl:template>
<!-- Retrieve the format string depending on the type of source. -->
<xsl:variable name="formatstring">
<xsl:choose>
<!-- Placeholders. -->
<xsl:when test="string-length($source/b:SourceType) = 0 and string-
length(msxsl:node-set($data)/bibliography/source[@type = 'Placeholder']/format) > 0">
<xsl:value-of select="msxsl:node-set($data)/bibliography/source[@type =
'Placeholder']/sortkey"/>
</xsl:when>
<!-- Type. (BibWord type overriding mechanism) -->
<xsl:when test="string-length($source/b:Type) > 0 and string-length(msxsl:node-
set($data)/bibliography/source[@type = $source/b:Type]/format) > 0 ">
<xsl:value-of select="msxsl:node-set($data)/bibliography/source[@type =
$source/b:Type]/sortkey"/>
</xsl:when>
<!-- SourceType. (Normal type) -->
<xsl:otherwise>
<xsl:value-of select="msxsl:node-set($data)/bibliography/source[@type =
$source/b:SourceType]/sortkey"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:template>
<!-- Informative variable indicating which version of BibWord this is. -->
<xsl:variable name="version">
<xsl:text>2.9</xsl:text>
</xsl:variable>
</xsl:stylesheet>