Skip to content
Permalink
bd204a5785
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
392 lines (376 sloc) 15.5 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:eoa="http://www.edition-open-access.de/ns"
exclude-result-prefixes="xs tei eoa"
version="2.0"
>
<xsl:output method="html" encoding="UTF-8"/>
<!-- use-character-maps="texreplacements"/>-->
<xsl:variable name="langid" select="//tei:langUsage/tei:language/@ident"/>
<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"/>
<!-- index sorting, https://stackoverflow.com/questions/13763271 -->
<xsl:key name="kWith1stLetter" match="family" use="substring(.,1,1)"/>
<!-- context: //tei:div[@type='chapter'] -->
<xsl:template name="render_chapter">
<xsl:param name="webdesign_url" as="xs:string"/>
<xsl:param name="publ_static_url" as="xs:string"/>
<xsl:param name="mathjax_url" as="xs:string" select="'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js'"/>
<xsl:param name="nav_items" as="element(eoa:entry)*"/>
<xsl:param name="indices" as="element(eoa:index)*"/>
<xsl:call-template name="website_template">
<xsl:with-param name="webdesign_url" select="$webdesign_url"/>
<xsl:with-param name="publ_static_url" select="$publ_static_url"/>
<xsl:with-param name="title">
<xsl:call-template name="chapter_title"/>
</xsl:with-param>
<!--
<xsl:with-param name="platform_name">Edition Open Access</xsl:with-param>
<xsl:with-param name="platform_link">http://edition-open-access.de</xsl:with-param>
-->
<xsl:with-param name="platform_logo">
<!-- TODO: replace by "text logo" -->
<xsl:value-of select="concat($webdesign_url, 'assets/images/logo.png')"/>
</xsl:with-param>
<xsl:with-param name="nav_items" as="element(eoa:entry)*" select="$nav_items"/>
<xsl:with-param name="meta_tags">
<xsl:call-template name="website_meta_tags">
<xsl:with-param name="citation_title">
<xsl:for-each select="tei:head">
<xsl:call-template name="render_heading"/>
</xsl:for-each>
</xsl:with-param>
<xsl:with-param name="citation_author">
<xsl:choose>
<xsl:when test="@resp">
<xsl:call-template name="format_persons">
<xsl:with-param name="person_refs" select="@resp"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="format_persons">
<xsl:with-param name="person_refs" select="//tei:titleStmt/tei:author/@ref | //tei:titleStmt/tei:editor[@role='volumeeditor']/@ref"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="dc_title">
<xsl:for-each select="tei:head">
<xsl:call-template name="render_heading"/>
</xsl:for-each>
</xsl:with-param>
<xsl:with-param name="dc_publisher">
<xsl:value-of select="//tei:publicationStmt/tei:publisher/tei:orgName[@n='Press']/tei:choice/tei:expan/text()"/>
</xsl:with-param>
<xsl:with-param name="dc_creator">
<xsl:call-template name="format_persons">
<xsl:with-param name="person_refs" select="//tei:titleStmt/tei:author/@ref | //tei:titleStmt/tei:editor[@role='volumeeditor']/@ref"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="breadcrumbs" as="element(eoa:entry)*">
<eoa:entry>
<eoa:link>
<xsl:value-of select="concat('./publications.html/', lower-case(//tei:seriesStmt/tei:title))"/>
</eoa:link>
<eoa:title>
<xsl:value-of select="//tei:seriesStmt/tei:title"/>
</eoa:title>
</eoa:entry>
<eoa:entry>
<eoa:link>
<xsl:value-of select="concat('../../', //tei:seriesStmt/tei:idno[@type='number'], '/index.html')"/>
</eoa:link>
<eoa:title>
<xsl:apply-templates select="//tei:titleStmt/tei:title[@type='main']"/>
</eoa:title>
</eoa:entry>
<eoa:entry active="1">
<eoa:title>
<xsl:for-each select="tei:head">
<xsl:call-template name="render_heading"/>
</xsl:for-each>
</eoa:title>
</eoa:entry>
</xsl:with-param>
<xsl:with-param name="main">
<main class="main publications publications2">
<div class="container">
<div class="main-content">
<!-- chapter table of contents -->
<section class="publications__overview">
<div class="accordion">
<div class="accordion__item accordion__item--border-top active">
<a class="accordion__title" href="#">
<h2>Overview</h2>
</a>
<div class="accordion__content">
<div class="publications__list">
<ul>
<xsl:for-each select="./tei:div[@type='section']">
<xsl:variable name="uri"><xsl:call-template name="uri_from_chapter"/></xsl:variable>
<li>
<xsl:element name="a">
<xsl:attribute name="href" select="$uri"/>
<xsl:value-of>
<xsl:call-template name="render_section_heading_numbered"/>
</xsl:value-of>
</xsl:element>
</li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</div>
<a class="link link--green" href="#">
<span class="link__label link__label--outer">Download Chapter</span>
</a>
</section>
<!-- chapter content: -->
<section class="publication-detail">
<xsl:call-template name="chapter_main">
<xsl:with-param name="indices" as="element(eoa:index)*" select="$indices" tunnel="yes"/>
</xsl:call-template>
<!-- back/forward navigation -->
<xsl:apply-templates mode="chapter_navigation" select="."/>
</section>
<!-- chapter content closed-->
</div>
</div>
</main>
</xsl:with-param>
<xsl:with-param name="footer_items" as="element(eoa:entry)*">
<eoa:entry>
<eoa:link><xsl:text>/imprint.html</xsl:text></eoa:link>
<eoa:title>Imprint &amp; Contact</eoa:title>
</eoa:entry>
<eoa:entry>
<eoa:link><xsl:text>/technical.html</xsl:text></eoa:link>
<eoa:title>Technical Information</eoa:title>
</eoa:entry>
</xsl:with-param>
<xsl:with-param name="script">
<xsl:if test=".//tei:formula">
<xsl:sequence select="eoa:info('adding mathjax...')"/>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
});
</script>
<script type="text/javascript" src="{$mathjax_url}"/>
</xsl:if>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="chapter_title">
<xsl:value-of select="//tei:publicationStmt/tei:publisher/tei:orgName[@n='Press']/tei:choice/tei:abbr/text()"/>
<xsl:text> | </xsl:text>
<xsl:apply-templates select="//tei:titleStmt/tei:title[@type='main']"/>
<xsl:text> | </xsl:text>
<xsl:for-each select="tei:head">
<xsl:call-template name="render_heading"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="footnotes">
<xsl:variable name="chapter" select="."/>
<xsl:if test="$chapter//tei:note[@place = 'bottom']">
<div class="accordion__item active">
<a class="accordion__title" href="#">
<h2> Footnotes </h2>
</a>
<div class="accordion__content">
<div class="publication-detail__footnotes">
<ol>
<xsl:for-each select="$chapter//tei:note[@place = 'bottom']">
<xsl:variable name="container_id" as="xs:string?">
<xsl:variable name="candidates" as="xs:string*">
<xsl:for-each select="ancestor::tei:*">
<!-- bottom up!: -->
<xsl:sort select="count(ancestor::*)" order="descending" data-type="number"/>
<xsl:variable name="container_id" as="xs:string?">
<xsl:call-template name="container_id"/>
</xsl:variable>
<xsl:variable name="current_elem">
<xsl:call-template name="eoa:print_elem"/>
</xsl:variable>
<xsl:if test="$container_id">
<xsl:value-of select="$container_id"/>
</xsl:if>
<xsl:sequence select="eoa:debug(concat('trying ', $current_elem))"/>
</xsl:for-each>
</xsl:variable>
<xsl:sequence select="eoa:debug(concat('candidates ', string-join($candidates, ',')))"/>
<xsl:if test="count($candidates) > 0">
<xsl:value-of select="$candidates[1]"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="footnote_id" as="xs:string">
<xsl:call-template name="footnote_id"/>
</xsl:variable>
<xsl:if test="not($container_id)">
<xsl:sequence select="eoa:warning(concat('no container id for footnote ', $footnote_id))"/>
</xsl:if>
<xsl:if test="$container_id">
<li id="{$footnote_id}">
<xsl:for-each select="tei:p">
<p><xsl:apply-templates mode="inline"/></p>
</xsl:for-each>
<a href="#{$container_id}">to paragraph</a>
</li>
</xsl:if>
</xsl:for-each>
</ol>
</div>
<!-- the link to close the accordeon: -->
<a class="accordion__pageup" href="#"></a> <a class="accordion__popap" href="#"></a>
<div class="accordion__popap-eye"></div>
</div>
</div>
</xsl:if>
</xsl:template>
<xsl:template name="chapter_main">
<div class="accordion">
<div class="accordion__main">
<xsl:call-template name="render_paragraph_container">
<xsl:with-param name="content" as="element()*">
<!-- print chapter heading -->
<h1 class="publication-detail__title">
<xsl:call-template name="render_section_heading_numbered"/>
</h1>
<!-- print chapter authors, if any -->
<xsl:if test="@resp != ''">
<p>
<xsl:call-template name="format_persons">
<xsl:with-param name="person_refs" select="@resp"/>
</xsl:call-template>
</p>
</xsl:if>
</xsl:with-param>
</xsl:call-template>
<!-- print chapter introductory paragraph level elements (the ones not inside a "section") -->
<xsl:apply-templates mode="chapter_main_paragraphs" select="(if (tei:div[@type = 'section']) then (tei:div[@type = 'section'][1]/preceding-sibling::*) else (*))[not(self::tei:head)]"/>
</div>
<a class="accordion__showall show" href="#">Close All</a>
<!-- print chapter content -->
<xsl:apply-templates mode="container" select="(if (tei:div[@type = 'section']) then (tei:div[@type = 'section'][1]/(. | following-sibling::*)) else ())[not(self::tei:head)]"/>
<xsl:call-template name="footnotes"/>
</div>
</xsl:template>
<xsl:template mode="chapter_navigation" match="*" priority="-100">
<xsl:sequence select="eoa:warning(concat('in mode ', $apos, 'chapter_navigation', $apos, ': no template for tei:', name(), '[@type=', $apos, @type, $apos, ']'))"/>
</xsl:template>
<xsl:template mode="chapter_navigation" match="tei:div[@type='chapter']">
<xsl:variable name="chapter_id"><xsl:call-template name="chapter_id"/></xsl:variable>
<xsl:variable name="prev_chap" as="element()?">
<xsl:sequence select="preceding-sibling::tei:div[@type = 'chapter'][1]"/>
</xsl:variable>
<xsl:variable name="next_chap" as="element()?">
<xsl:sequence select="following-sibling::tei:div[@type = 'chapter'][1]"/>
</xsl:variable>
<div class="navigation">
<xsl:if test="$prev_chap">
<xsl:variable name="prev_chap_name" as="xs:string?">
<xsl:value-of>
<xsl:for-each select="$prev_chap">
<xsl:call-template name="render_section_heading_numbered"/>
</xsl:for-each>
</xsl:value-of>
</xsl:variable>
<xsl:variable name="uri" as="xs:string?">
<xsl:for-each select="$prev_chap">
<xsl:call-template name="uri_from_chapter"/>
</xsl:for-each>
</xsl:variable>
<a class="navigation__button navigation__button--prev" href="{$uri}"><xsl:sequence select="$prev_chap_name"/></a>
</xsl:if>
<xsl:if test="$next_chap">
<xsl:variable name="next_chap_name" as="xs:string?">
<xsl:value-of>
<xsl:for-each select="$next_chap">
<xsl:call-template name="render_section_heading_numbered"/>
</xsl:for-each>
</xsl:value-of>
</xsl:variable>
<xsl:variable name="uri" as="xs:string?">
<xsl:for-each select="$next_chap">
<xsl:call-template name="uri_from_chapter"/>
</xsl:for-each>
</xsl:variable>
<a class="navigation__button navigation__button--next" href="{$uri}"><xsl:sequence select="$next_chap_name"/></a>
</xsl:if>
</div>
</xsl:template>
<!-- default rule: warning -->
<xsl:template mode="chapter_main_paragraphs" match="tei:*" priority="-100">
<xsl:sequence select="eoa:warning(concat('in mode ', $apos, 'chapter_main_paragraphs', $apos, ': no template for tei:', name(), '[@type=', $apos, @type, $apos, ']'))"/>
</xsl:template>
<xsl:template mode="chapter_main_paragraphs" match="tei:p" as="element(div)">
<xsl:variable name="id"><xsl:call-template name="container_id"/></xsl:variable>
<xsl:sequence select="eoa:info(concat('chapter paragraph', $id))"/>
<xsl:call-template name="render_paragraph_container">
<xsl:with-param name="content" as="element()*">
<p id="{$id}" class="publication-detail__main-paragraph">
<xsl:if test="@corresp">
<xsl:variable name="id" as="xs:string" select="eoa:normalize_reference(@corresp)"/>
<xsl:variable name="theorem" select="key('theoremdecls', $id)"/>
<xsl:variable name="theorem_group" select="key('theorems', $id)"/>
<xsl:variable name="theorem_nr" select="index-of($theorem_group/generate-id(), generate-id(.))"/>
<xsl:sequence select="eoa:info(concat(' (theorem nr', $theorem_nr, ')'))"/>
<b>
<xsl:value-of select="concat( $theorem/text(), ' ', $theorem_nr, ': ')"/>
</b>
</xsl:if>
<xsl:apply-templates mode="inline"/>
</p>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template mode="chapter_main_paragraphs" match="tei:epigraph">
<xsl:variable name="id"><xsl:call-template name="container_id"/></xsl:variable>
<xsl:sequence select="eoa:info(concat('chapter epigraph', $id))"/>
<xsl:call-template name="render_paragraph_container">
<xsl:with-param name="content" as="element()*">
<xsl:for-each select="tei:p">
<p id="{$id}" class="epigraph">
<em>
<xsl:apply-templates mode="inline"/>
</em>
</p>
</xsl:for-each>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template mode="chapter_main_paragraphs" match="tei:ab[@type = 'chapterabstract']">
<xsl:variable name="id"><xsl:call-template name="container_id"/></xsl:variable>
<xsl:sequence select="eoa:info(concat('paragraph', $id))"/>
<xsl:call-template name="render_paragraph_container">
<xsl:with-param name="content" as="element()*">
<p id="{$id}" class="abstract">
<xsl:apply-templates mode="inline"/>
</p>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template mode="chapter_main_paragraphs" match="tei:listBibl[@type = 'references']">
<xsl:variable name="id"><xsl:call-template name="container_id"/></xsl:variable>
<xsl:sequence select="eoa:info(concat('bibliography', $id))"/>
<xsl:call-template name="render_paragraph_container">
<xsl:with-param name="content" as="element()*">
<xsl:for-each select="tei:bibl">
<p class="bibliography">
<xsl:apply-templates mode="inline"/>
</p>
</xsl:for-each>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>