Dears, currently I am building up a custom citation sytle in WORD and I want to achive the following for the output of the biblipgraphy:
- Section of books should be displayed by their respective author (BookSection)
- The book author should be displayed as extra entry in the bibliography
- Output of both should be sorted into one list!
I have already got it work that two section of entries will show up in the bibliography by doing it like this:
<xsl:template match="b:Bibliography">
<html xmlns="https://www.w3.org/TR/REC-html40">
<body>
<xsl:variable name="Literatur">
<xsl:apply-templates select ="b:Source[b:SourceType = 'BookSection'] | b:Source[b:SourceType = 'Book'] | b:Source[b:SourceType = 'ArticleInAPeriodical']" />
<xsl:apply-templates select ="b:Source[b:SourceType = 'BookSection']" mode="ExtraBookAuthorEntry" />
</xsl:variable>
<xsl:copy-of select="$Literatur"/>
<span style="font-size: 12pt; font-family: 'TimesNewRoman'; font-weight: bold;">
<xsl:text>Internetquellen</xsl:text>
</span>
<xsl:apply-templates select = "b:Source[b:SourceType = 'InternetSite'] | b:Source[b:SourceType = 'DocumentFromInternetSite']">
<xsl:sort select="b:Tag" order="descending"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
Now the entries of the first apply-templates will be visible and below this there will be the extra section with the next apply-tempates.
Nevertheless, I just want to do a sort on both apply-templates inside the variable "Literatur"
How can I perform that sort? Can you help me out?
Thanks Simon
---- EDIT ----
I am using this code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"
xmlns:t="http://www.microsoft.com/temp">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template match="*" mode="outputHtml2">
<xsl:apply-templates mode="outputHtml"/>
</xsl:template>
<!--Match the root element, and dispatch to its children-->
<xsl:template match="/">
<xsl:apply-templates select="*" />
<xsl:choose>
<xsl:when test="b:Version">
<xsl:text>2020.10.23</xsl:text>
</xsl:when>
<xsl:when test="b:OfficeStyleKey">
<xsl:text>FOM Literatur</xsl:text>
</xsl:when>
<xsl:when test="b:XslVersion">
<xsl:text>1</xsl:text>
</xsl:when>
<xsl:when test="b:StyleNameLocalized">
<xsl:choose>
<xsl:when test="b:StyleNameLocalized/b:Lcid='1033'">
<xsl:text>FOM Literatur</xsl:text>
</xsl:when>
<xsl:when test="b:StyleNameLocalized/b:Lcid='2070'">
<xsl:text>FOM Literatur</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
<!--<xsl:variable name="book_Title">
<xsl:value-of select="(b:Title)" />
</xsl:variable>-->
</xsl:template>
<xsl:template match="b:GetImportantFields[b:SourceType = 'Book']">
<b:ImportantFields>
<b:ImportantField>
<xsl:text>b:Author/b:Author/b:NameList</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Title</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:ShortTitle</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Publisher</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:City</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Edition</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Year</xsl:text>
</b:ImportantField>
</b:ImportantFields>
</xsl:template>
<xsl:template match="b:GetImportantFields[b:SourceType = 'BookSection']">
<b:ImportantFields>
<b:ImportantField>
<!--AUTOR (Kurztitel, Jahr): Titel, in: Hrsg (Hrsg.), Buchtitel, Jahr, S. 277 - 299 -->
<xsl:text>b:Author/b:Author/b:NameList</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Title</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:ShortTitle</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:BookTitle</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Author/b:BookAuthor/b:NameList</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Publisher</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:City</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Edition</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Year</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Pages</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Comments</xsl:text>
</b:ImportantField>
</b:ImportantFields>
</xsl:template>
<!-- Artikel in einer Zeitschrift -->
<xsl:template match="b:GetImportantFields[b:SourceType = 'ArticleInAPeriodical']">
<b:ImportantFields>
<b:ImportantField>
<xsl:text>b:Author/b:Author/b:NameList</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Title</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:ShortTitle</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:PeriodicalTitle</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Volume</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Issue</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Year</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Pages</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Comments</xsl:text>
</b:ImportantField>
</b:ImportantFields>
</xsl:template>
<xsl:template match="b:GetImportantFields[b:SourceType = 'InternetSite']">
<b:ImportantFields>
<b:ImportantField>
<xsl:text>b:Author/b:Author/b:NameList</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Title</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:ShortTitle</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:InternetSiteTitle</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Year</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Month</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:Day</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:YearAccessed</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:MonthAccessed</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:DayAccessed</xsl:text>
</b:ImportantField>
<b:ImportantField>
<xsl:text>b:URL</xsl:text>
</b:ImportantField>
</b:ImportantFields>
</xsl:template>
<!--### Abschnitt 2: Hier wird festgelegt, wie die einzelnen Quellen im Literaturverzeichnis
ausgegeben werden sollen. Hier sind noch nicht alle Arten von Quellen eingetragen.
Ggf. müssen die entsprechenden Quellenarten noch hinzugefügt werden.###-->
<xsl:template match = "b:Source[b:SourceType = 'Book'] | b:Source[b:SourceType = 'Report'] | b:Source[b:SourceType = 'ElectronicSource']">
<p>
<i> <!--Autorenliste-->
<xsl:apply-templates select="b:Author/b:Author" mode="AuthorNamelistFull" />
</i>
<xsl:text> (</xsl:text>
<xsl:value-of select = "b:ShortTitle"/>
<xsl:text>, </xsl:text>
<xsl:value-of select = "b:Year"/>
<xsl:text>): </xsl:text>
<xsl:value-of select = "b:Title"/>
<xsl:text>, </xsl:text>
<xsl:if test="b:Edition != ''">
<xsl:value-of select = "b:Edition"/>
<xsl:text>. Aufl., </xsl:text>
</xsl:if>
<xsl:value-of select = "b:City"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="b:Publisher"/>
<xsl:text>, </xsl:text>
<xsl:value-of select = "b:Year"/>
</p>
<!-- <p style="font-family: Arial, Helvetica, sans-serif; font-size: 11pt;">
<span style="font-weight: bold; ">
<xsl:text>[</xsl:text>
<xsl:value-of select = "b:Tag"/>
<xsl:text>] </xsl:text>
</span> -->
<!--Autorenliste-->
<!-- <xsl:apply-templates select="b:Author/b:Author" mode="AuthorNamelistFull" />
<xsl:text>: </xsl:text> -->
<!--Titel-->
<!-- <xsl:value-of select = "b:Title"/> -->
<!--Datum-->
<!-- <xsl:text> (</xsl:text>
<xsl:value-of select = "b:City"/>
<xsl:text>, </xsl:text>
<xsl:value-of select = "b:Year"/>
<xsl:text>).</xsl:text>
</p> -->
</xsl:template>
<xsl:template match = "b:Source[b:SourceType = 'BookSection']">
<p>
<!--AUTOR (Kurztitel, Jahr): Titel, in: Hrsg (Hrsg.), Buchtitel, Jahr, S. 277 - 299 -->
<i> <!--Autorenliste-->
<xsl:apply-templates select="b:Author/b:Author" mode="AuthorNamelistFull" />
</i>
<xsl:text> (</xsl:text>
<xsl:value-of select = "b:ShortTitle"/>
<xsl:text>, </xsl:text>
<xsl:value-of select = "b:Year"/>
<xsl:text>): </xsl:text>
<xsl:value-of select = "b:Title"/>
<xsl:text>, in: </xsl:text>
<i>
<xsl:apply-templates select = "b:Author/b:BookAuthor" mode="BookAuthorNamelistFull" />
</i>
<xsl:text> (Hrsg.), </xsl:text>
<xsl:value-of select = "b:BookTitle"/>
<xsl:text>, </xsl:text>
<xsl:value-of select = "b:Year"/>
<xsl:text>, S. </xsl:text>
<xsl:value-of select = "b:Pages"/>
</p>
</xsl:template>
<!--Extra Eintrag fuer HRSG. vom Sammelband-->
<xsl:template match = "b:Source[b:SourceType = 'BookSection']" mode="ExtraBookAuthorEntry">
<p>
<i>
<xsl:apply-templates select="b:Author/b:BookAuthor" mode="BookAuthorNamelistFull" />
</i>
<xsl:text> (Hrsg.) (</xsl:text>
<!--TODO fuer ShortTitel vom Sammelband!!-->
<xsl:value-of select = "b:ShortTitle"/>
<xsl:text>, </xsl:text>
<xsl:value-of select = "b:Year"/>
<xsl:text>): </xsl:text>
<xsl:value-of select = "b:Title"/>
<xsl:text>, </xsl:text>
<xsl:if test="b:Edition != ''">
<xsl:value-of select = "b:Edition"/>
<xsl:text>. Aufl., </xsl:text>
</xsl:if>
<xsl:value-of select = "b:City"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="b:Publisher"/>
<xsl:text>, </xsl:text>
<xsl:value-of select = "b:Year"/>
</p>
</xsl:template>
<xsl:template match="b:Source[b:SourceType = 'ArticleInAPeriodical']">
<p>
<!--AUTOR (Kurztitel, Jahr): Titel, in: Hrsg (Hrsg.), Buchtitel, Jahr, S. 277 - 299 -->
<i> <!--Autorenliste-->
<xsl:apply-templates select="b:Author/b:Author" mode="AuthorNamelistFull" />
</i>
<xsl:text> (</xsl:text>
<xsl:value-of select = "b:ShortTitle"/>
<xsl:text>, </xsl:text>
<xsl:value-of select = "b:Year"/>
<xsl:text>): </xsl:text>
<xsl:value-of select = "b:Title"/>
<xsl:text>, in: </xsl:text>
<xsl:value-of select = "b:PeriodicalTitle" />
<xsl:text>, </xsl:text>
<xsl:if test="b:Volume != ''">
<xsl:value-of select = "b:Volume"/>
<xsl:text></xsl:text>
</xsl:if>
<xsl:text>(</xsl:text>
<xsl:value-of select = "b:Year"/>
<xsl:text>), </xsl:text>
<xsl:if test="b:Issue != ''">
<xsl:text>Nr. </xsl:text>
<xsl:value-of select = "b:Issue"/>
</xsl:if>
<xsl:text>, S. </xsl:text>
<xsl:value-of select = "b:Pages"/>
</p>
</xsl:template>
<xsl:template match = "b:Source[b:SourceType = 'InternetSite'] | b:Source[b:SourceType = 'DocumentFromInternetSite']">
<p>
<i> <!--Autorenliste-->
<xsl:apply-templates select="b:Author/b:Author" mode="AuthorNamelistFull" />
</i>
<xsl:text> (</xsl:text>
<xsl:value-of select = "b:ShortTitle"/>
<xsl:text>, </xsl:text>
<xsl:value-of select = "b:Year"/>
<xsl:text>): </xsl:text>
<xsl:value-of select = "b:Title"/>
<xsl:text>, <</xsl:text>
<xsl:value-of select = "b:URL"/>
<xsl:text>> </xsl:text>
<xsl:text>(</xsl:text>
<xsl:value-of select = "b:Day"/>
<xsl:text>.</xsl:text>
<xsl:value-of select = "b:Month"/>
<xsl:text>.</xsl:text>
<xsl:value-of select = "b:Year"/>
<xsl:text>) </xsl:text>
<xsl:text>[Zugriff: </xsl:text>
<xsl:value-of select = "b:DayAccessed"/>
<xsl:text>.</xsl:text>
<xsl:value-of select = "b:MonthAccessed"/>
<xsl:text>.</xsl:text>
<xsl:value-of select = "b:YearAccessed"/>
<xsl:text>]</xsl:text>
<!-- <xsl:if test="b:Edition != ''">
<xsl:value-of select = "b:Edition"/>
<xsl:text>. Aufl., </xsl:text>
</xsl:if> -->
</p>
</xsl:template>
<!--
<xsl:template match = "b:Source[b:SourceType = 'InternetSite'] | b:Source[b:SourceType = 'DocumentFromInternetSite']">
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 11pt;">
<xsl:apply-templates select="b:Author/b:Author" mode="AuthorNamelistFull" />
<xsl:text>: </xsl:text>
<xsl:value-of select = "b:Title"/>
<xsl:text> (</xsl:text>
<xsl:value-of select = "b:Year"/>
<xsl:text>) </xsl:text>
<br />
<span style="font-size: 10pt; color: #0000FF;">
<xsl:text>[</xsl:text>
<xsl:value-of select = "b:URL"/>
<xsl:text>]</xsl:text>
</span>
<span style="font-size: 10pt;">
<xsl:text> (Zugriff am: </xsl:text>
<xsl:value-of select = "b:DayAccessed"/>
<xsl:text>. </xsl:text>
<xsl:value-of select = "b:MonthAccessed"/>
<xsl:text>.</xsl:text>
<xsl:value-of select = "b:YearAccessed"/>
<xsl:text>).</xsl:text>
</span>
</p>
</xsl:template> -->
<!--FINISH Label the paragraph as an Office Bibliography paragraph-->
<!--### Abschnitt 3: Ausgabe im Literaturverzecihnis -->
<xsl:template match="b:Bibliography">
<html xmlns="https://www.w3.org/TR/REC-html40">
<body>
<xsl:variable name="Literatur">
<xsl:apply-templates select ="b:Source[b:SourceType = 'BookSection'] | b:Source[b:SourceType = 'Book'] | b:Source[b:SourceType = 'ArticleInAPeriodical']" />
<xsl:apply-templates select ="b:Source[b:SourceType = 'BookSection']" mode="ExtraBookAuthorEntry" />
</xsl:variable>
<xsl:copy-of select="$Literatur"/>
<span style="font-size: 12pt; font-family: 'TimesNewRoman'; font-weight: bold;">
<xsl:text>Internetquellen</xsl:text>
</span>
<xsl:apply-templates select = "b:Source[b:SourceType = 'InternetSite'] | b:Source[b:SourceType = 'DocumentFromInternetSite']">
<xsl:sort select="b:Tag" order="descending"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<!--<xsl:template match="b:Bibliography">
<html xmlns="http://www.w3.org/TR/REC-html40">
<body>
<xsl:apply-templates select ="b:Source[b:SourceType = 'Book']">
</xsl:apply-templates>
<xsl:apply-templates select = "b:Source[b:SourceType = 'Book'] | b:Source[b:SourceType = 'BookSection']">
<xsl:sort select="b:Tag" order="ascending"/>
</xsl:apply-templates>
<xsl:text>Onlinequellen</xsl:text>
<xsl:apply-templates select = "b:Source[b:SourceType = 'InternetSite'] | b:Source[b:SourceType = 'DocumentFromInternetSite']">
<xsl:sort select="b:Tag" order="ascending"/>
</xsl:apply-templates>
<br/>
</body>
</html>
</xsl:template>-->
<!--### Abschnitt 4: Hier wird festgelegt, wie einzelne Zitate ausgegeben werden.###-->
<xsl:template match = "b:Citation/b:Source">
<html xmlns = "http://www.w3.org/TR/REC-html40">
<body>
<!--Zu erst kommt das Tag, Bsp: [VanV]
<span style="font-weight:bold">
<xsl:text>[</xsl:text>
<xsl:value-of select = "b:Tag"/>
<xsl:text>] </xsl:text>
</span>-->
<!-- Autoren-->
<!--Anmerkung: Wie die Liste genau aufgebaut ist, steht in Abschnitt 5-->
<i>
<xsl:apply-templates select="b:Author/b:Author" mode="AuthorNamelistShort" />
</i>
<xsl:apply-templates select="b:Author/b:Interviewee" mode="AuthorNamelistVeryShort" />
<xsl:text>, </xsl:text>
<!--Schlagwort-->
<xsl:value-of select="b:ShortTitle"/>
<xsl:text>, </xsl:text>
<!--Datum-->
<xsl:value-of select = "b:Year"/>
<!--und noch die Seiten, wenn sie angegeben wurden-->
<xsl:if test="../b:Pages != ''">
<xsl:text>, S. </xsl:text>
<xsl:value-of select = "../b:Pages"/>
</xsl:if>
</body>
</html>
</xsl:template>
<!--### Abschnitt 5: Hier wird festgelegt, wie die verschieden langen Autoren- bzw- Interviewpartnerlisten ausgegeben werden.###-->
<!-- Vollständige Interviewpartnerliste -->
<xsl:template match="b:Interviewee" mode="IntervieweeNamelistFull">
<xsl:for-each select="b:NameList/b:Person">
<xsl:apply-templates select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="b:Corporate"/>
</xsl:template>
<!-- Vollständige Autorenliste -->
<xsl:template match="b:Author" mode="AuthorNamelistFull">
<!--<xsl:for-each select="b:NameList/b:Person">-->
<xsl:for-each select="b:NameList/b:Person">
<xsl:apply-templates select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="b:Corporate"/>
</xsl:template>
<!-- Vollständige Hrsg. Liste -->
<xsl:template match="b:BookAuthor" mode="BookAuthorNamelistFull">
<!--<xsl:for-each select="b:NameList/b:Person">-->
<xsl:for-each select="b:NameList/b:Person">
<xsl:apply-templates select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="b:Corporate"/>
</xsl:template>
<xsl:template match="b:Author" mode="AuthorNamelistShort">
<xsl:for-each select="b:NameList/b:Person">
<xsl:choose>
<xsl:when test="position() = 2">
<xsl:choose>
<xsl:when test="last() > 2">
<xsl:text> et al.</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>, </xsl:text>
<xsl:apply-templates select="." mode="FirstShort" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="position() > 2">
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="FirstShort" />
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:value-of select="b:Corporate"/>
</xsl:template>
<!--### Abschnitt 6: Hier wird festgelegt, wie der Name einer Einzelnen Person aufgebaut ist.###-->
<!-- Beispiel: "Vorname Vorname2 Nachname" -->
<xsl:template match="b:Person">
<xsl:if test="b:Last != ''">
<xsl:value-of select = "b:Last"/>
</xsl:if>
<xsl:text>, </xsl:text>
<xsl:if test="b:First != ''">
<xsl:value-of select = "b:First"/>
</xsl:if>
<xsl:if test="b:Middle != ''">
<xsl:text></xsl:text>
<xsl:value-of select = "b:Middle"/>
</xsl:if>
</xsl:template>
<xsl:template match="b:Person" mode="FirstShort">
<xsl:if test="b:Last != ''">
<xsl:value-of select = "b:Last"/>
</xsl:if>
<xsl:text>, </xsl:text>
<xsl:if test="b:First != ''">
<xsl:value-of select = "substring(b:First, 1,1)"/>
<xsl:text>.</xsl:text>
</xsl:if>
<xsl:if test="b:Middle != ''">
<xsl:text></xsl:text>
<xsl:value-of select = "substring(b:Middle, 1,1)"/>
<xsl:text>.</xsl:text>
</xsl:if>
</xsl:template>
<!--<xsl:value-of select="substring(b:Author/b:Author/b:NameList/b:Person/b:First, 1,1)" />-->
<xsl:template match="text()" />
</xsl:stylesheet>
You could try to sort the contents of the variable but in XSLT 1 that is only possible using a proprietary extension function so for MS Word try
instead of the
xsl:copy-of select="$Literatur"/>
.