Skip to content
Permalink
fc60b8a254
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
727 lines (693 sloc) 34.2 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">
<xsl:param name="frontmatter" as="xs:boolean" required="no" select="false()"/>
<xsl:param name="contributors" as="xs:boolean" required="no" select="false()"/>
<xsl:param name="strictfigures" as="xs:boolean" required="no" select="false()"/>
<xsl:param name="verbosity" as="xs:integer" required="no" select="0"/>
<xsl:param name="parts" as="xs:boolean" required="yes"/>
<xsl:variable name="langid" select="//tei:langUsage/tei:language/@ident"/>
<xsl:variable name="transl" select="document('data/aux/translations.xml')"/>
<xsl:key name="en" match="translations/entry" use="@en"/>
<xsl:key name="de" match="translations/entry" use="@de"/>
<xsl:key name="fr" match="translations/entry" use="@fr"/>
<xsl:key name="it" match="translations/entry" use="@it"/>
<xsl:output method="text" encoding="UTF-8" use-character-maps="texreplacements"/>
<xsl:character-map name="texreplacements">
<!--
the character map replaces characters
In the stylesheet below, a sign (&#x2E0E;) is used to denote a
comment in LaTeX. The sign itself is unlikely to occur in the
text. The LaTeX comment sign is originally a percent sign, but
since this the percent sign needs to be escaped in other
contexts, a double replacement is performed.
-->
<xsl:output-character character="&#x23;" string="\#"/>
<xsl:output-character character="&#x26;" string="\&amp;"/>
<xsl:output-character character="&#x25;" string="\%"/>
<xsl:output-character character="&#x2E0E;" string="%"/>
</xsl:character-map>
<xsl:strip-space elements="*"/>
<xsl:template match="*">
<!--
catchall template
https://stackoverflow.com/questions/3360017/why-does-xslt-output-all-text-by-default
-->
<xsl:value-of select="eoa:debug(2, 'Unmatched element: ', name())"/>
<xsl:apply-templates/>
</xsl:template>
<!-- ignore some header fields -->
<xsl:template match="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:author|tei:editor|tei:resp|tei:persName"/>
<xsl:template match="//tei:teiHeader/tei:fileDesc/tei:editionStmt|tei:publicationStmt"/>
<xsl:template match="//tei:teiHeader/tei:fileDesc/tei:sourceDesc/tei:p"/>
<xsl:template match="//tei:teiHeader/tei:encodingDesc|tei:profileDesc|tei:revisionDesc"/>
<xsl:function name="eoa:texcomment">
<xsl:param name="message" as="xs:string"/>
<xsl:text>&#x2E0E;&#x2E0E; </xsl:text>
<xsl:value-of select="$message"/>
<xsl:text>&#x000a;</xsl:text>
</xsl:function>
<xsl:function name="eoa:debug">
<xsl:param name="level" as="xs:integer"/>
<xsl:param name="message" as="xs:string"/>
<xsl:param name="node" />
<xsl:choose>
<xsl:when test="$level = 1 and $verbosity > 0">
<xsl:message terminate="no">[INFO]: <xsl:value-of select="$message"/> <xsl:value-of select="$node"/></xsl:message>
</xsl:when>
<xsl:when test="$level = 2 and $verbosity > 1">
<xsl:message terminate="no">[WARNING]: <xsl:value-of select="$message"/> <xsl:value-of select="$node"/></xsl:message>
</xsl:when>
<xsl:when test="$level = 3 and $verbosity > 2">
<xsl:message terminate="yes">[ERROR]: <xsl:value-of select="$message"/> <xsl:value-of select="$node"/>. Exiting.</xsl:message>
</xsl:when>
</xsl:choose>
</xsl:function>
<xsl:template match="/">
<xsl:value-of select="eoa:texcomment(concat('LaTeX output, generated by script tei2eoatex.xsl on ', current-dateTime()))" />
<xsl:value-of select="eoa:texcomment(concat('Using ', system-property('xsl:product-name'), system-property('xsl:product-version'), ' by ', system-property('xsl:vendor'), ' (', system-property('xsl:vendor-url'), ')'))" />
<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;</xsl:text>
<xsl:choose>
<xsl:when test="$frontmatter">
<xsl:text>\input{texfiles/frontmatter.tex}&#x000a;</xsl:text>
<xsl:call-template name="writefrontmatter"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="eoa:debug(1, 'Not writing the frontmatter.', '')" />
<xsl:text>&#x000a;</xsl:text>
<xsl:value-of select="eoa:texcomment('No frontmatter created yet. Insert it like so:')" />
<xsl:value-of select="eoa:texcomment('\input{texfiles/frontmatter.tex}')" />
<xsl:text>&#x000a;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>\EOAtoc&#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:choose>
<xsl:when test="$parts">
<xsl:value-of select="eoa:debug(1, 'Book has parts. ', name())"/>
<xsl:call-template name="hasparts"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="eoa:debug(1, 'Book has no parts, the highest level is chapter. ', name())"/>
<xsl:call-template name="hasnoparts"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>\end{document}&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="tei:body//tei:p[not(ancestor::tei:note)]">
<xsl:choose>
<xsl:when test="@rend='quote'">
<xsl:text>\begin{EOAquote}</xsl:text>
<xsl:apply-templates/>
<xsl:text>\end{EOAquote}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>&#x000a;&#x000a;</xsl:text>
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="//tei:hi[@rend='italic']" >
<xsl:text>\EOAemph{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:div[not(@type='chapter' or @type='part')]/tei:head">
<xsl:choose>
<xsl:when test="../@type='section'">
<xsl:text>&#x000a;&#x000a;\EOAsection</xsl:text>
</xsl:when>
<xsl:when test="../@type='subsection'">
<xsl:text>&#x000a;&#x000a;\EOAsubsection</xsl:text>
</xsl:when>
<xsl:when test="../@type='subsubsection'">
<xsl:text>&#x000a;&#x000a;\EOAsubsubsection</xsl:text>
</xsl:when>
</xsl:choose>
<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:text>{</xsl:text>
<xsl:apply-templates />
<xsl:text>}</xsl:text>
<xsl:choose>
<xsl:when test="not(../@xml:id)">
<xsl:value-of select="eoa:debug(1, 'No ID for section: ', 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>&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="//tei:bibl">
<xsl:choose>
<xsl:when test="./tei:ref[@type='inline']">
<xsl:text>\EOAciteyear</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\EOAciteauthoryear</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="./tei:citedRange[not(@*)]">
<xsl:text>[</xsl:text>
<xsl:apply-templates/>
<xsl:text>]</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="./tei:citedRange/@from">
<xsl:text>[</xsl:text>
<xsl:value-of select="./tei:citedRange/@from"/>
<xsl:choose>
<xsl:when test="./tei:citedRange/@to">
<xsl:text>–</xsl:text>
<xsl:value-of select="./tei:citedRange/@to"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="eoa:debug(1, 'Citation has no @to value. ', tei:ref/@target)" />
</xsl:otherwise>
</xsl:choose>
<xsl:text>]</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:text>{</xsl:text>
<xsl:value-of select="substring-after(./tei:ref/@target, '#')"/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:note[@place='bottom']">
<xsl:text>\EOAfn{</xsl:text>
<xsl:text>\EOAlabel{</xsl:text>
<xsl:value-of select="./@xml:id"/>
<xsl:text>}</xsl:text>
<xsl:choose>
<xsl:when test="count(./tei:p)=1">
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="count(./tei:p)>1">
<xsl:value-of select="eoa:debug(1, 'Number of paragraphs in larger than 1 ', node())" />
<xsl:for-each select="./tei:p">
<xsl:choose>
<xsl:when test="position() != last()">
<xsl:apply-templates />
<xsl:text>\EOAfnpar </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
</xsl:choose>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:body//tei:ref[starts-with(@type, 'number')]">
<xsl:text>\EOAref{</xsl:text>
<xsl:value-of select="substring-after(@target, '#')"/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:body//tei:ref[@type='url']">
<xsl:text>\EOAurl{</xsl:text>
<xsl:value-of select="@target"/>
<xsl:text>}</xsl:text>
</xsl:template>
<xsl:template match="//tei:figure[@type='hionly']">
<xsl:text>&#x000a;\refstepcounter{figure}&#x2E0E;&#x000a;</xsl:text>
</xsl:template>
<xsl:template match="//tei:figure[not(@type='hionly')]">
<xsl:text>&#x000a;&#x000a;\EOAfigure{</xsl:text>
<xsl:value-of select="./tei:graphic/@url"/>
<xsl:text>}{</xsl:text>
<xsl:apply-templates select="./tei:head"/>
<xsl:text>}</xsl:text>
<xsl:text>{</xsl:text>
<xsl:value-of select="@xml:id"/>
<xsl:text>}</xsl:text>
<!-- need size! -->
<xsl:text>{66}</xsl:text>
<!-- place needs to be adjusted -->
<xsl:choose>
<xsl:when test="$strictfigures">
<xsl:text>{H}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>{ht}</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="processing-instruction('eoa')">
<xsl:choose>
<xsl:when test="starts-with(., 'printbibliography')">
<xsl:choose>
<xsl:when test="substring-after(., ' ')">
<xsl:text>\EOAprintbibliography[</xsl:text>
<xsl:value-of select="substring-after(., ' ')"/>
<xsl:text>]&#x000a;&#x000a;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\EOAprintbibliography&#x000a;&#x000a;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="starts-with(., 'printindex')">
<xsl:text>\EOAprintindex&#x000a;&#x000a;</xsl:text>
</xsl:when>
<xsl:when test="starts-with(., 'printpersonindex')">
<xsl:text>\EOAprintpersonindex&#x000a;&#x000a;</xsl:text>
</xsl:when>
<xsl:when test="starts-with(., 'printlocationindex')">
<xsl:text>\EOAprintlocationindex&#x000a;&#x000a;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="eoa:debug(2, 'Unrecognized processing instruction: ', current())" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="format_persons">
<xsl:param name="people"/>
<xsl:variable name="joined_people" select="string-join($people, '')"/>
<xsl:variable name="num_people" select="count($people)"/>
<xsl:choose>
<xsl:when test="$num_people = 1">
<xsl:for-each select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt[contains($joined_people, @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_people = 2">
<xsl:for-each select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt[contains($joined_people, @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_people > 2">
<xsl:for-each select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt[contains($joined_people, @xml:id)]">
<xsl:value-of select="concat(./tei:persName/tei:forename, ' ', ./tei:persName/tei:surname)"/>
<!-- <xsl:value-of select="$formatted_author"/> -->
<xsl:choose>
<xsl:when test="position() &lt; $num_people - 1">
<xsl:text>, </xsl:text>
</xsl:when>
<xsl:when test="position()=$num_people - 1">
<xsl:text> and </xsl:text>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="eoa:debug(3, 'No book author. Exiting.', '')" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="hasparts">
<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:apply-templates select="*[position() > 1]"/>
</xsl:result-document>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template name="hasnoparts">
<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/chapter', format-number(position(), '00'), '.tex')"/>
<xsl:text>}&#x000a;&#x000a;</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:apply-templates select="*[position() > 1]"/>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
<xsl:template name="writecontributors">
<xsl:result-document method="text" include-content-type="no" href="{'texfiles/contributors.tex'}">
<xsl:value-of select="eoa:texcomment('List of contributors')" />
<xsl:for-each select="//tei:titleStmt/tei:respStmt">
<!-- sorting by lang="de" incorporates diacritics into the alphabet -->
<xsl:sort lang="de" select="tei:persName/tei:surname"/>
<xsl:sort lang="de" select="tei:persName/tei:forename"/>
<xsl:for-each select=".">
<xsl:if test="contains(tei:resp, 'chapter author')">
<xsl:text>\noindent\textbf{</xsl:text>
<xsl:variable name="people" select="@xml:id"/>
<xsl:call-template name="format_persons">
<xsl:with-param name="people" select="$people"/>
</xsl:call-template>
<xsl:text>}&#x000a;</xsl:text>
<xsl:for-each select="tei:persName/tei:affiliation">
<xsl:text>\noindent </xsl:text>
<xsl:value-of select="tei:roleName"/>
<xsl:text>\\&#x000a;</xsl:text>
<xsl:for-each select="tei:orgName">
<xsl:text>\noindent </xsl:text>
<xsl:value-of select="."/>
<xsl:text>\\&#x000a;</xsl:text>
</xsl:for-each>
</xsl:for-each>
<xsl:text>\noindent </xsl:text>
<xsl:value-of select="tei:persName/tei:email"/>
<xsl:text>\\&#x000a;</xsl:text>
<xsl:text>&#x000a;</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:result-document>
</xsl:template>
<xsl:template name="writefrontmatter">
<xsl:result-document method="text" include-content-type="no" href="{'texfiles/frontmatter.tex'}">
<xsl:value-of select="eoa:texcomment('New version: 160205 reflecting hierarchy of EOA over MPRL')" />
<xsl:value-of select="eoa:texcomment('Last used for Studies 8: Space volume')" />
<xsl:text>\pagestyle{empty}&#x000a;\pagenumbering{roman}&#x000a;\setcounter{page}{1} &#x2E0E;&#x000a;&#x000a;</xsl:text>
<xsl:value-of select="eoa:texcomment('Page 1: Just the title')" />
<xsl:text>\begin{center}&#x000a;\Large{</xsl:text>
<xsl:apply-templates select="//tei:titleStmt/tei:title[@type='main']"/>
<xsl:text>}\\&#x000a;&#x000a;\vspace{2mm}&#x000a;&#x000a;\large{</xsl:text>
<xsl:apply-templates select="//tei:titleStmt/tei:title[@type='sub']"/>
<xsl:text>}&#x000a;\end{center}&#x000a;&#x000a;\newpage&#x000a;&#x000a;</xsl:text>
<xsl:value-of select="eoa:texcomment('Page 2: Series Editors, Team, Board, Edition Open Access description, year')" />
<xsl:text>\begin{center}&#x000a;\large \EOAbold{</xsl:text>
<xsl:apply-templates select="//tei:publicationStmt/tei:publisher/tei:orgName[@n='EOA']"/>
<xsl:text>}&#x000a;\end{center}&#x000a;&#x000a;</xsl:text>
<xsl:text>\vspace{15mm}&#x000a;\noindent\EOAbold{</xsl:text>
<xsl:value-of select="//tei:seriesStmt/tei:respStmt/tei:resp"/>
<xsl:text>}\\[2mm]&#x000a;</xsl:text>
<xsl:value-of select="//tei:seriesStmt/tei:respStmt/tei:name[@type='serieseditors']"/>
<!-- Ian T.\ Baldwin, Gerd Graßhoff, Jürgen Renn, Dagmar Schäfer,\\Robert Schlögl, Bernard F.\ Schutz -->
<xsl:text>&#x000a;&#x000a;\vspace{10mm}&#x000a;\noindent\EOAbold{Edition Open Access Development Team}\\[2mm]&#x000a;</xsl:text>
<xsl:value-of select="//tei:projectDesc/tei:p[@n='eoadevteam']"/>
<xsl:text>&#x000a;&#x000a;\vspace{10mm}&#x000a;\noindent </xsl:text>
<xsl:apply-templates select="//tei:projectDesc/tei:p[@n='eoainfo'][1]"/>
<xsl:text>\vspace{3pt}&#x000a;&#x000a;\noindent </xsl:text>
<xsl:apply-templates select="//tei:projectDesc/tei:p[@n='eoainfo'][2]"/>
<xsl:text>&#x000a;\newpage&#x000a;&#x000a;</xsl:text>
<xsl:value-of select="eoa:texcomment('Page 3: Title, subtitle, author/editor, series, year')" />
<xsl:text>\begin{minipage}[t]{90mm}</xsl:text>
<xsl:text>&#x000a;&#x000a;\vspace*{12mm}&#x000a;\begin{center}&#x000a;\Large {</xsl:text>
<xsl:apply-templates select="//tei:titleStmt/tei:title[@type='main']"/>
<xsl:text>}\\&#x000a;&#x000a;\vspace{2mm}&#x000a;\large{</xsl:text>
<xsl:apply-templates select="//tei:titleStmt/tei:title[@type='sub']"/>
<xsl:text>}&#x000a;\end{center}&#x000a;&#x000a;\vspace{10mm}&#x000a;\begin{center}&#x000a;\large </xsl:text>
<xsl:variable name="people" select="//tei:titleStmt/tei:author/@ref | //tei:titleStmt/tei:editor[@role='volumeeditor']/@ref"/>
<xsl:call-template name="format_persons">
<xsl:with-param name="people" select="$people"/>
</xsl:call-template>
<xsl:if test="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:editor[@role='volumeeditor']">
<!-- observe number of people here, name is taken from translations file -->
<xsl:choose>
<xsl:when test="count($people) = 1">
<xsl:variable name="keyterm" select="$transl//entry[@name='editor-abbr']"/>
<xsl:value-of select="concat(' (', $keyterm/@*[local-name() = $langid], ')')"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="keyterm" select="$transl//entry[@name='editors-abbr']"/>
<xsl:value-of select="concat(' (', $keyterm/@*[local-name() = $langid], ')')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:text>&#x000a;\end{center}&#x000a;&#x000a;\vspace{126mm}&#x000a;\begin{center}&#x000a;\large {\EOAbold{</xsl:text>
<xsl:value-of select="concat(//tei:seriesStmt/tei:title, '\ ', //tei:seriesStmt/tei:idno[@type='number'])"/>
<xsl:text>}}&#x000a;\end{center}&#x000a;&#x000a;\end{minipage}\newpage&#x000a;&#x000a;</xsl:text>
<xsl:value-of select="eoa:texcomment('Page 4: Complete Series Information, Communicator, Assistance, Gratitude, ISBN-Number, License')" />
<xsl:text>\begin{flushleft}&#x000a;\noindent </xsl:text>
<xsl:value-of select="//tei:publicationStmt/tei:publisher/tei:orgName[@n='Press']"/>
<xsl:text>\\&#x000a;\noindent </xsl:text>
<xsl:value-of select="concat(//tei:seriesStmt/tei:title, '\ ', //tei:seriesStmt/tei:idno[@type='number'])"/>
<xsl:text>\\&#x000a;\vspace{4mm}&#x000a;\noindent Submitted by: </xsl:text>
<xsl:variable name="submitters" select="//tei:titleStmt/tei:editor[@role='submitter']/@ref"/>
<xsl:call-template name="format_persons">
<xsl:with-param name="people" select="$submitters"/>
</xsl:call-template>
<xsl:text>\\&#x000a;\vspace{4mm}&#x000a;\noindent Editorial Team:\\</xsl:text>
<xsl:variable name="editorialteam" select="//tei:titleStmt/tei:editor[not(@role='volumeeditor' or @role='submitter')]/@ref"/>
<xsl:call-template name="format_persons">
<xsl:with-param name="people" select="$editorialteam"/>
</xsl:call-template>
<xsl:text>\\&#x000a;\vspace{4mm}&#x000a;\noindent Image Processing: \\</xsl:text>
<xsl:text>Digitization group of the Max Planck Institute for the History of Science\\&#x000a;&#x000a;</xsl:text>
<xsl:value-of select="eoa:texcomment('\noindent Sponsoring Institutions: optional info&#x000a;')" />
<xsl:if test="//tei:titleStmt/tei:sponsor">
<xsl:text>\noindent Scholarly Support: &#x000a;&#x000a;</xsl:text>
<xsl:apply-templates select="//tei:titleStmt/tei:sponsor"/>
<xsl:text>&#x000a;&#x000a;</xsl:text>
</xsl:if>
<xsl:if test="//tei:titleStmt/tei:funder">
<xsl:text>\noindent Financial Support:&#x000a;&#x000a;</xsl:text>
<xsl:apply-templates select="//tei:titleStmt/tei:funder"/>
<xsl:text>&#x000a;&#x000a;</xsl:text>
</xsl:if>
<xsl:text>\vspace{4mm}&#x000a;&#x000a;\noindent Cover Image:\\&#x000a;\noindent </xsl:text>
<xsl:apply-templates select="//tei:text/tei:front/tei:figure/tei:head"/>
<xsl:text>\\&#x000a;&#x000a;\vspace{4mm}&#x000a;\noindent </xsl:text>
<xsl:apply-templates select="//tei:profileDesc/tei:abstract[@n='additional']"/>
<xsl:text>&#x000a;\end{flushleft}&#x000a;&#x000a;</xsl:text>
<xsl:text>\vfill&#x000a;\begin{flushleft}&#x000a;\begin{footnotesize}&#x000a;\noindent ISBN </xsl:text>
<xsl:value-of select="//tei:publicationStmt/tei:idno[@type='isbn']"/>
<xsl:text>\\&#x000a;First published </xsl:text>
<xsl:value-of select="substring-before(//tei:publicationStmt/tei:date/@when, '-')"/>
<xsl:text> by </xsl:text>
<xsl:value-of select="//tei:publicationStmt/tei:publisher/tei:orgName[@n='EOA']"/>
<xsl:text>,\\&#x000a;Max Planck Institute for the History of Science\\&#x000a;</xsl:text>
<xsl:value-of select="//tei:publicationStmt/tei:publisher/tei:orgName[@n='EOA']/@ref"/>
<xsl:text>\\&#x000a;Printed and distributed by\\&#x000a;</xsl:text>
<xsl:apply-templates select="//tei:publicationStmt/tei:distributor/tei:orgName"/>
<xsl:text>\\&#x000a;Published under </xsl:text>
<xsl:apply-templates select="//tei:publicationStmt/tei:availability/tei:licence"/>
<xsl:text>\\&#x000a;</xsl:text>
<xsl:value-of select="//tei:publicationStmt/tei:availability/tei:licence/@target"/>
<xsl:text>&#x000a;\\[2mm]&#x000a;The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie; detailed bibliographic data are available in the Internet at http://dnb.d-nb.de.&#x000a;</xsl:text>
<xsl:text>\end{footnotesize}&#x000a;\end{flushleft}&#x000a;\newpage&#x000a;\normalsize&#x000a;&#x000a;</xsl:text>
<xsl:value-of select="eoa:texcomment('Page 5: Complete Series Information,')" />
<xsl:text>\noindent \small\EOAbold{</xsl:text>
<xsl:apply-templates select="//tei:publicationStmt/tei:publisher/tei:orgName[@n='Press']"/>
<xsl:text>}\\&#x000a;&#x000a;\vspace{6pt}&#x000a;&#x000a;\noindent </xsl:text>
<xsl:apply-templates select="//tei:projectDesc/tei:p[@n='mprlinformation']"/>
<xsl:text>&#x000a;&#x000a;\vspace{30pt}&#x000a;&#x000a;\noindent\small\EOAbold{Scientific Board}\\&#x000a;&#x000a;\vspace{3pt}</xsl:text>
<xsl:text>&#x000a;\begin{footnotesize}&#x000a;&#x000a;\noindent </xsl:text>
<xsl:apply-templates select="//tei:projectDesc/tei:p[@n='scientificboard']"/>
<xsl:text>&#x000a;\end{footnotesize}&#x000a;\clearpage&#x000a;\mbox{}&#x000a;</xsl:text>
<xsl:value-of select="eoa:texcomment('\newpage')" />
<xsl:value-of select="eoa:texcomment('Optional: Pages 5 and 6: Dedication, followed by a blank page')" />
<xsl:if test="//tei:text/tei:front/tei:div[@type='dedication']">
<xsl:text>\vspace*{25mm}&#x000a;\begin{center}&#x000a;</xsl:text>
<xsl:apply-templates select="//tei:text/tei:front/tei:div[@type='dedication']"/>
<xsl:text>&#x000a;\end{center}&#x000a; \clearpage&#x000a;\mbox{}&#x000a;</xsl:text>
</xsl:if>
<xsl:value-of select="eoa:texcomment('\newpage&#x000a;&#x000a;\normalsize&#x000a;')" />
<xsl:value-of select="eoa:texcomment('Following pages use normal page style, which is fancy')" />
<xsl:text>\pagestyle{fancy}&#x000a;</xsl:text>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>