Permalink
Cannot retrieve contributors at this time
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?
EOASkripts/src/tei2html/utils/common.xsl
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
285 lines (275 sloc)
11.4 KB
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
<?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" | |
indent="yes" | |
/> | |
<xsl:variable name="apos" as="xs:string">'</xsl:variable> | |
<!-- | |
<xsl:param name="verbosity" as="xs:integer" required="no" select="0"/> | |
--> | |
<xsl:template name="website_meta_tags"> | |
<xsl:param name="citation_title"/> | |
<xsl:param name="citation_author"/> | |
<xsl:param name="dc_title"/> | |
<xsl:param name="dc_publisher"/> | |
<xsl:param name="dc_creator"/> | |
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/> | |
<meta name="viewport" content="width=device-width, initial-scale=1"/> | |
<meta http-equiv="pragma" content="no-cache"/> | |
<meta name="citation_title" content="{$citation_title}"/> | |
<meta name="citation_date" content="{//tei:publicationStmt/tei:date/@when}"/> | |
<meta name="citation_author" content="{$citation_author}"/> | |
<meta name="DC.title" content="{$dc_title}"/> | |
<meta name="DC.issued" content="{replace(//tei:publicationStmt/tei:date/@when, '-','/')}"/> | |
<meta name="DC.publisher" content="{$dc_publisher}"/> | |
<meta name="DC.type" content="Text"/> | |
<meta name="DC.creator" content="{$dc_creator}"/> | |
</xsl:template> | |
<xsl:template name="website_template"> | |
<xsl:param name="breadcrumb_items" as="element(eoa:entry)*"/> | |
<xsl:param name="nav_items" as="element(eoa:entry)*"/> | |
<xsl:param name="footer_items" as="element(eoa:entry)*"/> | |
<xsl:param name="platform_name"/> | |
<xsl:param name="platform_link"/> | |
<xsl:param name="platform_logo"/> | |
<xsl:param name="title"/> | |
<xsl:param name="meta_tags"/> | |
<xsl:param name="main"/> | |
<xsl:param name="script"/> | |
<xsl:param name="webdesign_url" as="xs:string"/> | |
<xsl:param name="publ_static_url" as="xs:string"/> | |
<xsl:param name="breadcrumbs" as="element(eoa:entry)*"/> | |
<html lang="{//tei:profileDesc/tei:langUsage/tei:language/@ident}"> | |
<head> | |
<title> | |
<xsl:copy-of select="$title"/> | |
</title> | |
<link rel="shortcut icon" href="{eoa:conc_path($webdesign_url, 'favicon.png')}"/> | |
<link href="{eoa:conc_path($webdesign_url, 'app.css')}" rel="stylesheet"/> | |
<xsl:copy-of select="$meta_tags"/> | |
</head> | |
<body> | |
<div class="page"> | |
<div class="content"> | |
<div class="mobile-header__background"/> | |
<header class="header"> | |
<div class="header__content"> | |
<div class="blocklogo container"> | |
<div class="blocklogo__logo"> | |
<a href="{$platform_link}"> | |
<img class="blocklogo__img" src="{eoa:conc_path($webdesign_url, 'logo.png')}" alt="logo" data-object-fit="cover"/> | |
</a> | |
</div> | |
</div> | |
<nav class="nav"> | |
<a class="nav-toggle" href="#"> | |
<span class="nav-toggle__item"/> | |
<span class="nav-toggle__item"/> | |
<span class="nav-toggle__item"/> | |
</a> | |
<div class="nav__wrapper"> | |
<div class="container"> | |
<ul class="nav__menu"> | |
<xsl:for-each select="$nav_items[self::eoa:entry]"> | |
<xsl:choose> | |
<xsl:when test="@active"> | |
<li class="nav__item nav__item--active"> | |
<a class="nav__link nav__link--active" href="{eoa:link}"> | |
<xsl:value-of select="eoa:title"/> | |
</a> | |
</li> | |
</xsl:when> | |
<xsl:otherwise> | |
<li class="nav__item"> | |
<a class="nav__link" href="{eoa:link}"> | |
<xsl:value-of select="eoa:title"/> | |
</a> | |
</li> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:for-each> | |
<!-- | |
if we reactivate this, remove the space from '- -' | |
<li class="nav__item nav__item- -active"><a class="nav__link nav__link- -active" href="./publications.html">Publications</a></li> | |
<li class="nav__item"><a class="nav__link" href="/publishing-conditions.html">Publishing Conditions</a></li> | |
<li class="nav__item"><a class="nav__link" href="/author/index.html">Authors</a></li> | |
<li class="nav__item"><a class="nav__link" href="/editorial-board.html">Editorial Board</a></li> | |
<li class="nav__item"><a class="nav__link" href="/publication-policy.html">Publication Policy</a></li> | |
<li class="nav__item nav-search" id="nav-search"> | |
<form class="nav-search-form"> | |
<input class="nav-search__input" placeholder="Search" type="search" value="" name="search" id="search"/> | |
<input class="nav-search__submit" type="submit" value=""/> | |
</form> | |
</li> | |
--> | |
<!-- what's supposed to be that?: | |
<li class="nav__item nav-footer"> | |
<xsl:for-each select="$footer_items[self::eoa:entry]"> | |
<a class="nav__link nav-footer__link" href="{eoa:link}"> | |
<xsl:value-of select="eoa:title"/> | |
</a> | |
</xsl:for-each> | |
</li> | |
--> | |
</ul> | |
</div> | |
</div> | |
</nav> | |
<nav class="breadcrumbs container"> | |
<ul class="breadcrumbs__items"> | |
<xsl:for-each select="$breadcrumbs[self::eoa:entry]"> | |
<li class="breadcrumbs__item"> | |
<xsl:choose> | |
<xsl:when test="@active"> | |
<span class="breadcrumbs__link-current" style="max-width: 800px;"> | |
<xsl:value-of select="eoa:title"/> | |
</span> | |
</xsl:when> | |
<xsl:otherwise> | |
<a class="breadcrumbs__link" href="{eoa:link}" title="{eoa:title}"> | |
<xsl:value-of select="eoa:title"/> | |
</a> | |
</xsl:otherwise> | |
</xsl:choose> | |
</li> | |
</xsl:for-each> | |
</ul> | |
</nav> | |
</div> | |
</header> | |
<xsl:copy-of select="$main"/> | |
</div> | |
<footer class="footer"> | |
<div class="footer__content"> | |
<div class="footer-menu"> | |
<xsl:for-each select="$footer_items[self::eoa:entry]"> | |
<a href="{eoa:link}"> | |
<xsl:value-of select="eoa:title"/> | |
</a> | |
</xsl:for-each> | |
<a class="share" href="#">Share<span>this Page</span></a> | |
</div> | |
<div class="footer-logo"> | |
<a class="footer-logo__link" href="{$platform_link}" target="_blank"> | |
<img class="logo logo--text" src="{$platform_logo}" alt="{$platform_name}"/> | |
</a> | |
</div> | |
</div> | |
</footer> | |
<!-- | |
<xsl:copy-of select="$footer"/> | |
--> | |
</div> | |
<script type="text/javascript" src="{eoa:conc_path($webdesign_url, 'app.js')}"/> | |
<xsl:copy-of select="$script"/> | |
</body> | |
</html> | |
</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: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:error('No book author!')"/> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:template> | |
<xsl:template name="format_string_authors"> | |
<xsl:param name="authors"/> | |
<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: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: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: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() < $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:error('No chapter author: ', node())"/> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:template> | |
<xsl:function name="eoa:conc_path" as="xs:string"> | |
<xsl:param name="p1" as="xs:string"/> | |
<xsl:param name="p2" as="xs:string"/> | |
<xsl:choose> | |
<xsl:when test="starts-with($p2, '/') or $p2 = '' or $p1 = ''"> | |
<xsl:sequence select="$p2"/> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:sequence select="concat(eoa:strip_pathsep($p1), '/', $p2)"/> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:function> | |
<xsl:function name="eoa:conc_path3" as="xs:string"> | |
<xsl:param name="p1" as="xs:string"/> | |
<xsl:param name="p2" as="xs:string"/> | |
<xsl:param name="p3" as="xs:string"/> | |
<xsl:sequence select="eoa:conc_path($p1, eoa:conc_path($p2, $p3))"/> | |
</xsl:function> | |
<xsl:function name="eoa:strip_pathsep" as="xs:string"> | |
<xsl:param name="path" as="xs:string"/> | |
<xsl:sequence select="replace($path, '/$', '')"/> | |
</xsl:function> | |
</xsl:stylesheet> |