Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
EOASkripts/data/tei2eoatex-noparts.xsl
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
132 lines (127 sloc)
5.96 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:tei="http://www.tei-c.org/ns/1.0" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:xlink="http://www.w3.org/1999/xlink" | |
xmlns:eoa="http://www.edition-open-access.de/ns" | |
exclude-result-prefixes="xs tei" | |
version="2.0"> | |
<xsl:include href="tei2eoatex-common.xsl"/> | |
<xsl:template match="/"> | |
<xsl:text>⸎ LaTeX output, generated by a script on </xsl:text> | |
<xsl:value-of select="current-dateTime()"/> | |
<xsl:text>
</xsl:text> | |
<xsl:text>\input{preambel/pre_eoa}
</xsl:text> | |
<xsl:text>\EOAbibliographytype{</xsl:text> | |
<xsl:value-of select="//tei:sourceDesc/tei:ab[@type='bibdatabase']/tei:ref/@type"/> | |
<xsl:text>}
</xsl:text> | |
<xsl:text>\EOAbibliographydatabase{</xsl:text> | |
<xsl:value-of select="//tei:sourceDesc/tei:ab[@type='bibdatabase']/tei:ref/@target"/> | |
<xsl:text>}
</xsl:text> | |
<xsl:text>\EOAseries{</xsl:text> | |
<xsl:apply-templates select="//tei:seriesStmt/tei:title"/> | |
<xsl:text>}
</xsl:text> | |
<xsl:text>
\begin{document}
\input{texfiles/frontmatter.tex}
</xsl:text> | |
<xsl:text>\EOAtoc
\newpage
\pagenumbering{arabic}
\setcounter{page}{1}
</xsl:text> | |
<xsl:choose> | |
<xsl:when test="$contributors"> | |
<xsl:text>
\EOAchapternonumber{List of Contributors}{List of Contributors}
</xsl:text> | |
<xsl:text>\input{texfiles/contributors.tex}

</xsl:text> | |
<xsl:call-template name="writecontributors"/> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:value-of select="eoa:debug(1, 'Not writing list of contributors.', node())" /> | |
<xsl:text>
</xsl:text> | |
</xsl:otherwise> | |
</xsl:choose> | |
<xsl:for-each select="//tei:div[@type='chapter']/tei:head"> | |
<xsl:text>\EOAchapter</xsl:text> | |
<xsl:choose> | |
<xsl:when test="../@rend='nonumber'"> | |
<xsl:text>nonumber</xsl:text> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:value-of select="eoa:debug(1, 'Section has number: ', node())" /> | |
</xsl:otherwise> | |
</xsl:choose> | |
<xsl:choose> | |
<xsl:when test="./tei:choice"> | |
<xsl:text>{</xsl:text> | |
<xsl:apply-templates select="./tei:choice/tei:abbr"/> | |
<xsl:text>}{</xsl:text> | |
<xsl:apply-templates select="./tei:choice/tei:expan"/> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:text>{</xsl:text> | |
<xsl:apply-templates select="."/> | |
<xsl:text>}{</xsl:text> | |
<xsl:apply-templates select="."/> | |
</xsl:otherwise> | |
</xsl:choose> | |
<!-- next with thanks to https://www.oxygenxml.com/forum/topic712.html --> | |
<xsl:variable name="authors" select="../@resp"/> | |
<xsl:variable name="num_authors" select="count(//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt[contains($authors, @xml:id)])"/> | |
<xsl:choose> | |
<xsl:when test="$num_authors = 1"> | |
<xsl:text>\EOAauthor{</xsl:text> | |
<xsl:for-each select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt[contains($authors, @xml:id)]"> | |
<xsl:variable name="formatted_author" select="concat(./tei:persName/tei:forename, ' ', ./tei:persName/tei:surname)"/> | |
<xsl:value-of select="$formatted_author"/> | |
</xsl:for-each> | |
</xsl:when> | |
<xsl:when test="$num_authors = 2"> | |
<xsl:text>\EOAauthor{</xsl:text> | |
<xsl:for-each select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt[contains($authors, @xml:id)]"> | |
<xsl:variable name="formatted_author" select="concat(./tei:persName/tei:forename, ' ', ./tei:persName/tei:surname)"/> | |
<xsl:value-of select="$formatted_author"/> | |
<xsl:if test="position()!=last()"> | |
<xsl:text> and </xsl:text> | |
</xsl:if> | |
</xsl:for-each> | |
</xsl:when> | |
<xsl:when test="$num_authors > 2"> | |
<xsl:text>\EOAauthor{</xsl:text> | |
<xsl:for-each select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt[contains($authors, @xml:id)]"> | |
<xsl:variable name="formatted_author" select="concat(./tei:persName/tei:forename, ' ', ./tei:persName/tei:surname)"/> | |
<xsl:value-of select="$formatted_author"/> | |
<xsl:choose> | |
<xsl:when test="position() < $num_authors - 1"> | |
<xsl:text>, </xsl:text> | |
</xsl:when> | |
<xsl:when test="position()=$num_authors - 1"> | |
<xsl:text> and </xsl:text> | |
</xsl:when> | |
</xsl:choose> | |
</xsl:for-each> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:value-of select="eoa:debug(1, 'No chapter author: ', node())" /> | |
<xsl:text>}</xsl:text> | |
</xsl:otherwise> | |
</xsl:choose> | |
<xsl:text>}</xsl:text> | |
<xsl:text>}
</xsl:text> | |
<xsl:choose> | |
<xsl:when test="not(../@xml:id)"> | |
<xsl:value-of select="eoa:debug(1, 'Chapter has no ID: ', node())" /> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:text>\EOAlabel{</xsl:text> | |
<xsl:value-of select="../@xml:id"/> | |
<xsl:text>}
</xsl:text> | |
</xsl:otherwise> | |
</xsl:choose> | |
<xsl:text>\input{</xsl:text> | |
<xsl:value-of select="concat('texfiles/chapter', format-number(position(), '00'), '.tex')"/> | |
<xsl:text>}

</xsl:text> | |
</xsl:for-each> | |
<xsl:for-each select="//tei:div[@type='chapter']"> | |
<xsl:result-document method="text" include-content-type="no" href="{concat('texfiles/chapter', format-number(position(), '00'), '.tex')}"> | |
<xsl:text>⸎ single file</xsl:text> | |
<xsl:apply-templates select="*[position() > 1]"/> | |
</xsl:result-document> | |
</xsl:for-each> | |
<xsl:text>\end{document}
</xsl:text> | |
<xsl:call-template name="writefrontmatter"/> | |
</xsl:template> | |
</xsl:stylesheet> |