Skip to content
Permalink
0170e6f946
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
468 lines (460 sloc) 18.6 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"/>
<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)"/>
<xsl:template name="render_publication_frontpage">
<xsl:param name="webdesign_url" as="xs:string"/>
<xsl:param name="publ_static_url" as="xs:string"/>
<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:apply-templates select="//tei:titleStmt/tei:title[@type='main']"/>
</xsl:with-param>
<xsl:with-param name="platform_logo">
<!-- TODO: replace by "text logo" -->
<xsl:value-of select="eoa:conc_path($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:apply-templates select="//tei:titleStmt/tei:title[@type='main']"/>
</xsl:with-param>
<xsl:with-param name="citation_author">
<xsl:variable name="person_refs" as="xs:string+" select="//tei:titleStmt/tei:author/@ref | //tei:titleStmt/tei:editor[@role='volumeeditor']/@ref"/>
<xsl:call-template name="format_persons">
<xsl:with-param name="person_refs" select="$person_refs"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="dc_title">
<xsl:apply-templates select="//tei:titleStmt/tei:title[@type='main']"/>
</xsl:with-param>
<xsl:with-param name="dc_publisher">
<xsl:value-of select="//tei:publicationStmt/tei:publisher/tei:orgName[@n='EOA']"/>
</xsl:with-param>
<xsl:with-param name="dc_creator">
<xsl:variable name="person_refs" as="xs:string+" select="//tei:titleStmt/tei:author/@ref | //tei:titleStmt/tei:editor[@role='volumeeditor']/@ref"/>
<xsl:call-template name="format_persons">
<xsl:with-param name="person_refs" select="$person_refs"/>
</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 active="1">
<eoa:title>
<xsl:apply-templates select="//tei:titleStmt/tei:title[@type='main']"/>
</eoa:title>
</eoa:entry>
</xsl:with-param>
<xsl:with-param name="main">
<main class="main publications">
<div class="container">
<div class="main-content">
<section class="publications__teaser">
<div class="project-teaser">
<div class="project-teaser__image">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="eoa:conc_path($publ_static_url, //tei:front/tei:figure[@type='cover']/tei:graphic/@url)"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="concat('Cover image of ', //tei:titleStmt/tei:title[@type='main'])"/>
</xsl:attribute>
<xsl:attribute name="data-object-fit">
<xsl:text>cover</xsl:text>
</xsl:attribute>
</xsl:element>
</div>
<div class="project-teaser-info">
<div class="project-teaser-info__category">
<xsl:value-of select="concat(//tei:seriesStmt/tei:title, ' ', //tei:seriesStmt/tei:idno[@type='number'])"/>
</div>
<h2 class="project-teaser-info__title">
<xsl:apply-templates select="//tei:titleStmt/tei:title[@type='main']"/>
</h2>
<xsl:variable name="person_refs" as="xs:string*" select="//tei:titleStmt/tei:author/@ref | //tei:titleStmt/tei:editor[@role='volumeeditor']/@ref"/>
<xsl:element name="a">
<xsl:attribute name="class">
<xsl:text>project-teaser-info__author-link</xsl:text>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:text>#</xsl:text>
</xsl:attribute>
<xsl:call-template name="format_linked_persons">
<xsl:with-param name="person_refs" select="$person_refs"/>
</xsl:call-template>
</xsl:element>
<span>
<xsl:attribute name="class">
<xsl:text>project-teaser-info__author-link</xsl:text>
</xsl:attribute>
<xsl:if test="//tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:editor[@role='volumeeditor']">
<xsl:choose>
<xsl:when test="count($person_refs) = 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>
</span>
<div class="project-teaser-info__buttons">
<xsl:element name="a">
<xsl:attribute name="class">
<xsl:text>link link--green</xsl:text>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:for-each select="//tei:body//tei:div[@type = 'chapter'][1]">
<xsl:call-template name="uri_from_frontpage"/>
</xsl:for-each>
</xsl:attribute>
<span class="link__label">READ ONLINE</span>
</xsl:element>
<xsl:element name="a">
<xsl:attribute name="class">
<xsl:text>link ml-20</xsl:text>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:text>#</xsl:text>
</xsl:attribute>
<span class="link__label link__label--inner">PDF</span>
</xsl:element>
<xsl:element name="a">
<xsl:attribute name="class">
<xsl:text>link ml-20</xsl:text>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:text>#</xsl:text>
</xsl:attribute>
<span class="link__label link__label--inner">EBOOK</span>
</xsl:element>
</div>
<div class="project-teaser-info__subtext">
Click on the entries in the Table of Contents below to download individual chapters.
<br/>
This publication is licensed under a
<xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="//tei:availability/tei:licence/@target"/></xsl:attribute><xsl:attribute name="target"><xsl:text>_blank</xsl:text></xsl:attribute><xsl:value-of select="//tei:availability/tei:licence"/>
Licence
</xsl:element>
.</div>
</div>
</div>
<div class="publications-phone__additional-info">
<div class="publishing__buttons-block publishing__phone-btn">
<div class="more-block">
<button class="more-block__btn link" type="button" name="read" value="read">Read</button>
<div class="more-block__drop-down more-block__drop-down_small">
<xsl:element name="a"><xsl:attribute name="class"><xsl:text>arrow-link</xsl:text></xsl:attribute><xsl:attribute name="href"><xsl:text>./1/index.html</xsl:text></xsl:attribute>
Online
</xsl:element>
<xsl:element name="a"><xsl:attribute name="class"><xsl:text>arrow-link_down</xsl:text></xsl:attribute><xsl:attribute name="href"><xsl:text>#</xsl:text></xsl:attribute>
PDF
</xsl:element>
<xsl:element name="a"><xsl:attribute name="class"><xsl:text>arrow-link_down</xsl:text></xsl:attribute><xsl:attribute name="href"><xsl:text>#</xsl:text></xsl:attribute>
EBOOK
</xsl:element>
</div>
</div>
</div>
<div class="project-teaser-info__subtext">
This publication is licensed under a
<xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="//tei:availability/tei:licence/@target"/></xsl:attribute><xsl:attribute name="target"><xsl:text>_blank</xsl:text></xsl:attribute><xsl:value-of select="//tei:availability/tei:licence"/></xsl:element>
Licence.
</div>
</div>
</section>
<section>
<div class="publications-info">
<div class="accordion">
<div class="accordion__item accordion__item--border-top active">
<a class="accordion__title" href="#">
<h2>Information</h2>
</a>
<div class="accordion__content">
<div class="layout-col-3">
<div class="column">
<div class="row">
<h4>ISBN</h4>
<p>
<xsl:value-of select="//tei:publicationStmt/tei:idno[@type='isbn']"/>
</p>
<h4>Pages</h4>
<p>
<xsl:value-of select="//tei:fileDesc/tei:extent/tei:measure[@commodity='pages']/@quantity"/>
</p>
<h4>Publication Date</h4>
<p>
<xsl:variable name="pubdate" select="//tei:publicationStmt/tei:date/@when"/>
<xsl:value-of select="format-date($pubdate, '[MNn] [D1], [Y]')"/>
</p>
</div>
</div>
<div class="column">
<div class="row">
<h4>Print on Demand</h4>
<p>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="//tei:publicationStmt/tei:distributor/tei:orgName/@ref"/>
</xsl:attribute>
<xsl:value-of select="substring-before(//tei:publicationStmt/tei:distributor/tei:orgName, ' digital')"/>
</xsl:element>
</p>
<h4>Price</h4>
<p>
<xsl:value-of select="//tei:fileDesc/tei:extent/tei:measure[@type='price']/@quantity"/>
<xsl:if test="//tei:fileDesc/tei:extent/tei:measure[@type='price']/@unit='EUR'">
<xsl:text> &#x20AC;</xsl:text>
</xsl:if>
</p>
</div>
</div>
<div class="column">
<xsl:if test="//tei:titleStmt/tei:editor[@role='submitter']">
<div class="row">
<h4>Submitted by</h4>
<p>
<xsl:variable name="submitter_refs" as="xs:string+"
select="//tei:titleStmt/tei:editor[@role='submitter']/@ref"/>
<xsl:call-template name="format_persons">
<xsl:with-param name="person_refs" select="$submitter_refs"/>
</xsl:call-template>
</p>
</div>
</xsl:if>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="publishing__block publication__tabs">
<div class="tabs">
<div class="tabs__head">
<ul class="tabs__items">
<li class="tabs__item">
<a class="tabs__label" href="#">DESCRIPTION</a>
</li>
<li class="tabs__item">
<a class="tabs__label" href="#">TABLE OF CONTENTS</a>
</li>
<xsl:if test="//tei:body//tei:index[@indexName='keyword']">
<li class="tabs__item">
<a class="tabs__label" href="#">INDEX</a>
</li>
</xsl:if>
<xsl:if test="//tei:body//tei:index[@indexName='location']">
<li class="tabs__item">
<a class="tabs__label" href="#">INDEX OF LOCATIONS</a>
</li>
</xsl:if>
<xsl:if test="//tei:body//tei:index[@indexName='person']">
<li class="tabs__item">
<a class="tabs__label" href="#">INDEX OF NAMES</a>
</li>
</xsl:if>
</ul>
</div>
<div class="tabs__content">
<div class="tabs__content-item">
<xsl:apply-templates select="//tei:profileDesc/tei:abstract[@n='detailed']/tei:p"/>
</div>
<div class="tabs__content-item">
<div class="publications__content">
<xsl:for-each select="//tei:body/tei:div[@type=('part', 'chapter')]">
<xsl:choose>
<xsl:when test="@type='part'">
<h4><xsl:value-of select="tei:head"/></h4>
<xsl:for-each select="tei:div[@type='chapter']">
<h5>
<xsl:call-template name="toc_entry"/>
</h5>
</xsl:for-each>
</xsl:when>
<xsl:when test="@type='chapter'">
<h5>
<xsl:call-template name="toc_entry"/>
</h5>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</div>
</div>
<xsl:for-each select="$indices">
<xsl:call-template name="render_index"/>
</xsl:for-each>
</div>
</div>
</div>
</section>
</div>
</div>
</main>
</xsl:with-param>
<xsl:with-param name="footer_items" as="element(eoa:entry)*">
<eoa:entry>
<eoa:link><xsl:text>/contact.html</xsl:text></eoa:link>
<eoa:title>Contact</eoa:title>
</eoa:entry>
<eoa:entry>
<eoa:link><xsl:text>/imprint.html</xsl:text></eoa:link>
<eoa:title>Imprint</eoa:title>
</eoa:entry>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="toc_entry">
<xsl:variable name="chapter_id"><xsl:call-template name="chapter_id"/></xsl:variable>
<xsl:apply-templates mode="section_nr_prefix" select="."/>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:call-template name="uri_from_frontpage"/>
</xsl:attribute>
<xsl:for-each select="tei:head">
<xsl:call-template name="render_heading"/>
</xsl:for-each>
</xsl:element>
<xsl:if test="@resp != ''">
<br/>
<xsl:variable name="person_refs" as="xs:string+" select="@resp"/>
<em>
<xsl:call-template name="format_persons">
<xsl:with-param name="person_refs" select="$person_refs"/>
</xsl:call-template>
</em>
</xsl:if>
</xsl:template>
<xsl:template name="format_linked_persons">
<xsl:param name="person_refs" as="xs:string*" />
<xsl:sequence select="eoa:debug(concat('person_refs: ', string-join($person_refs, ',')))"/>
<xsl:variable name="ctxt" select="/"/>
<xsl:variable name="persons" as="element()*">
<xsl:for-each select="eoa:prepare_ref_strings($person_refs)">
<xsl:variable name="id" select="."/>
<xsl:sequence select="eoa:debug(concat('id: ', string-join($id, ',')))"/>
<xsl:variable name="person" as="element()?">
<xsl:sequence select="$ctxt//*[@xml:id = $id]"/>
</xsl:variable>
<xsl:if test="not($person)">
<xsl:sequence select="eoa:warning(concat('person with id ', $id, ' not found!'))"/>
</xsl:if>
<xsl:sequence select="$person"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="num_persons" select="count($persons)"/>
<xsl:choose>
<xsl:when test="$num_persons >= 1">
<xsl:for-each select="$persons">
<a
class="project-teaser-info__author-link"
ref="#"
>
<xsl:value-of select="concat(./tei:persName/tei:forename, ' ', ./tei:persName/tei:surname)"/>
</a>
<xsl:choose>
<xsl:when test="position() &lt; $num_persons - 1">
<span class="project-teaser-info__author-link">
<xsl:text>, </xsl:text>
</span>
</xsl:when>
<xsl:when test="position()=$num_persons - 1">
<span class="project-teaser-info__author-link">
<xsl:text> and </xsl:text>
</span>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="eoa:error('No book author.')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="render_index" as="element()*">
<div class="tabs__content-item">
<div class="publications__index-name">
<div class="accordion">
<a class="accordion__showall" href="#">Show All</a>
<xsl:for-each-group
select="eoa:term"
group-by="substring(@key,1,1)"
>
<div class="accordion__item">
<a class="accordion__title" href="#">
<h2 class="border">
<xsl:value-of select="current-grouping-key()"/>
</h2>
</a>
<div class="accordion__content">
<xsl:for-each select="current-group()">
<xsl:call-template name="render_index_term"/>
</xsl:for-each>
</div>
</div>
</xsl:for-each-group>
</div>
</div>
</div>
</xsl:template>
<xsl:template name="render_index_term">
<xsl:param name="depth" as="xs:string" select="''"/>
<xsl:choose>
<xsl:when test="$depth = ''">
<h4>
<xsl:value-of select="concat($depth, eoa:title)"/>
</h4>
</xsl:when>
<xsl:otherwise>
<h5>
<xsl:value-of select="concat($depth, eoa:title)"/>
</h5>
</xsl:otherwise>
</xsl:choose>
<ul>
<!-- print entries: -->
<xsl:for-each select="eoa:entry">
<li>
<a href="{
concat(
'./',
string-join(eoa:link/eoa:entry[position()>2 and position() != last()],'/'),
'/index.html#', eoa:link/eoa:entry[last()]
)
}"> <xsl:value-of select="position()"/></a>
</li>
</xsl:for-each>
</ul>
<!-- print subterms: -->
<xsl:for-each select="eoa:term">
<xsl:call-template name="render_index_term">
<xsl:with-param name="depth" select="concat($depth,'-')"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>