-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kthoden
committed
Dec 8, 2020
1 parent
cfed49d
commit b3bff8a
Showing
7 changed files
with
2,046 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?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: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>}\par
</xsl:text> | ||
<xsl:for-each select="tei:persName/tei:affiliation"> | ||
<xsl:text>\noindent </xsl:text> | ||
<xsl:value-of select="tei:roleName"/> | ||
<xsl:text>\\
</xsl:text> | ||
<xsl:for-each select="tei:orgName"> | ||
<xsl:text>\noindent </xsl:text> | ||
<xsl:value-of select="."/> | ||
<xsl:text>\\
</xsl:text> | ||
</xsl:for-each> | ||
</xsl:for-each> | ||
<xsl:text>\noindent </xsl:text> | ||
<xsl:value-of select="tei:persName/tei:email"/> | ||
<xsl:text>\\
</xsl:text> | ||
<xsl:text>
</xsl:text> | ||
</xsl:if> | ||
</xsl:for-each> | ||
</xsl:for-each> | ||
</xsl:result-document> | ||
</xsl:template> | ||
</xsl:stylesheet> |
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?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:function name="eoa:texcomment"> | ||
<xsl:param name="message" as="xs:string"/> | ||
<xsl:text>⸎⸎ </xsl:text> | ||
<xsl:value-of select="$message"/> | ||
<xsl:text>
</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 = 0 and $verbosity >= 3"> | ||
<xsl:message>[DEBUG]: <xsl:value-of select="$message"/> <xsl:value-of select="$node"/></xsl:message> | ||
</xsl:when> | ||
<xsl:when test="$level = 1 and $verbosity >= 2"> | ||
<xsl:message>[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>[WARNING]: <xsl:value-of select="$message"/> <xsl:value-of select="$node"/></xsl:message> | ||
</xsl:when> | ||
<xsl:when test="$level = 3"> | ||
<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:stylesheet> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?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:template name="combine_names"> | ||
<xsl:choose> | ||
<xsl:when test="./tei:persName/@xml:lang='zh'"> | ||
<xsl:variable name="formatted_author" select="concat(./tei:persName/tei:surname, ' ', ./tei:persName/tei:forename)"/> | ||
<xsl:value-of select="$formatted_author"/> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:variable name="formatted_author" select="concat(./tei:persName/tei:forename, ' ', ./tei:persName/tei:surname)"/> | ||
<xsl:value-of select="$formatted_author"/> | ||
</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:call-template name="combine_names"/> | ||
</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:call-template name="combine_names"/> | ||
<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:call-template name="combine_names"/> | ||
<!-- <xsl:value-of select="concat(./tei:persName/tei:forename, ' ', ./tei:persName/tei:surname)"/> --> | ||
<xsl:choose> | ||
<xsl:when test="position() < $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> | ||
|
||
<!-- next with thanks to https://www.oxygenxml.com/forum/topic712.html --> | ||
<!-- expected ctxt: div[@type = 'chapter'] --> | ||
<xsl:template name="eoaauthor"> | ||
<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 = 0"> | ||
<xsl:value-of select="eoa:debug(1, 'No authors found in this chapter.', '')" /> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:text>\\ \textnormal{\textit{</xsl:text> | ||
<xsl:choose> | ||
<xsl:when test="$num_authors = 1"> | ||
<xsl:for-each select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt[contains($authors, @xml:id)]"> | ||
<xsl:call-template name="combine_names"/> | ||
</xsl:for-each> | ||
</xsl:when> | ||
<xsl:when test="$num_authors = 2"> | ||
<xsl:for-each select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt[contains($authors, @xml:id)]"> | ||
<xsl:call-template name="combine_names"/> | ||
<xsl:if test="position()!=last()"> | ||
<xsl:text> and </xsl:text> | ||
</xsl:if> | ||
</xsl:for-each> | ||
</xsl:when> | ||
<xsl:when test="$num_authors > 2"> | ||
<xsl:for-each select="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:respStmt[contains($authors, @xml:id)]"> | ||
<xsl:call-template name="combine_names"/> | ||
<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: ', '')" /> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
<xsl:text>}}</xsl:text> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:template> | ||
</xsl:stylesheet> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?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:template match="//processing-instruction()[name()='latex']"> | ||
<xsl:sequence select="eoa:debug(0, 'found processing instruction. type latex', '')"/> | ||
<xsl:value-of select="."/> | ||
</xsl:template> | ||
|
||
<xsl:template match="processing-instruction('eoa')"> | ||
<xsl:sequence select="eoa:debug(0, 'found processing instruction. type: eoa', '')"/> | ||
<xsl:choose> | ||
<xsl:when test="contains(., 'printbibliography')"> | ||
<xsl:choose> | ||
<xsl:when test="substring-after(., ' ')"> | ||
<xsl:text>\printbibliography[</xsl:text> | ||
<xsl:value-of select="substring-after(., ' ')"/> | ||
<xsl:text>]

</xsl:text> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:text>\printbibliography

</xsl:text> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:when> | ||
<xsl:when test="contains(., 'printindex')"> | ||
<xsl:text>\printindex[keywords]

</xsl:text> | ||
</xsl:when> | ||
<xsl:when test="contains(., 'printpersonindex')"> | ||
<xsl:text>\printindex[persons]

</xsl:text> | ||
</xsl:when> | ||
<xsl:when test="contains(., 'printlocationindex')"> | ||
<xsl:text>\printindex[locations]

</xsl:text> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="eoa:debug(2, 'Unrecognized processing instruction: ', current())" /> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
</xsl:template> | ||
</xsl:stylesheet> |
Oops, something went wrong.