Skip to content
Permalink
7586de7434
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
157 lines (150 sloc) 7.05 KB
<?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">
<!--
make:
- can we re-integrate it?
-->
<xsl:include href="tei2eoatex-common.xsl"/>
<xsl:template match="/">
<xsl:value-of select="eoa:texcomment('this is an announcement')" />
<xsl:text>&#x2E0E; LaTeX output, generated by a script on </xsl:text>
<xsl:value-of select="current-dateTime()"/>
<xsl:text>&#x000a;</xsl:text>
<xsl:text>\input{preambel/pre_eoa}&#x000a;</xsl:text>
<xsl:text>\EOAbibliographytype{</xsl:text>
<xsl:value-of select="//tei:sourceDesc/tei:ab[@type='bibdatabase']/tei:ref/@type"/>
<xsl:text>}&#x000a;</xsl:text>
<xsl:text>\EOAbibliographydatabase{</xsl:text>
<xsl:value-of select="//tei:sourceDesc/tei:ab[@type='bibdatabase']/tei:ref/@target"/>
<xsl:text>}&#x000a;</xsl:text>
<xsl:text>\EOAseries{</xsl:text>
<xsl:apply-templates select="//tei:seriesStmt/tei:title"/>
<xsl:text>}&#x000a;</xsl:text>
<xsl:text>&#x000a;\begin{document}&#x000a;\input{texfiles/frontmatter.tex}&#x000a;</xsl:text>
<xsl:text>\EOAtoc&#x000a;\newpage&#x000a;\pagenumbering{arabic}&#x000a;\setcounter{page}{1}&#x000a;</xsl:text>
<xsl:choose>
<xsl:when test="$contributors">
<xsl:text>&#x000a;\EOAchapternonumber{List of Contributors}{List of Contributors}&#x000a;</xsl:text>
<xsl:text>\input{texfiles/contributors.tex}&#x000a;&#x000a;</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>&#x000a;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:for-each select="//tei:div[@type='part']/tei:head">
<xsl:variable name="partposition" select="position()"/>
<xsl:text>\EOApart{</xsl:text>
<xsl:apply-templates select="."/>
<xsl:choose>
<xsl:when test="not(../@xml:id)">
<xsl:value-of select="eoa:debug(1, 'No ID for part', node())" />
<xsl:text>}&#x000a;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>}\EOAlabel{</xsl:text>
<xsl:value-of select="../@xml:id"/>
<xsl:text>}&#x000a;</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() &lt; $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>}&#x000a;</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>}&#x000a;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>\input{</xsl:text>
<xsl:value-of select="concat('texfiles/part', $partposition, '-chapter', format-number(position(), '00'), '.tex')"/>
<xsl:text>}&#x000a;&#x000a;</xsl:text>
</xsl:for-each>
<xsl:for-each select="../tei:div[@type='chapter']">
<!-- <xsl:variable name="chapterposition" select="position()"/> -->
<xsl:result-document method="text" include-content-type="no" href="{concat('texfiles/part', $partposition, '-chapter', format-number(position(), '00'), '.tex')}">
<xsl:value-of select="eoa:texcomment('A subordinate file.')" />
<xsl:text>&#x2E0E; single file</xsl:text>
<xsl:apply-templates select="*[position() > 1]"/>
</xsl:result-document>
</xsl:for-each>
</xsl:for-each>
<xsl:text>\end{document}&#x000a;</xsl:text>
<xsl:call-template name="writefrontmatter"/>
</xsl:template>
</xsl:stylesheet>