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/stylesheets/tei2html/utils/render.xsl
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
317 lines (307 sloc)
12.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: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 charset="utf-8"/> | |
<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_uri}"> | |
<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_uri}" 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> | |
<!-- context: tei:table --> | |
<xsl:template name="render_table_heading_numbered"> | |
<xsl:param name="abbreviate" as="xs:boolean" select="false()"/> | |
<xsl:apply-templates mode="table_nr_prefix" select="."/> | |
<xsl:for-each select="tei:head"> | |
<xsl:call-template name="render_heading"> | |
<xsl:with-param name="abbreviate" select="$abbreviate"/> | |
</xsl:call-template> | |
</xsl:for-each> | |
</xsl:template> | |
<!-- context: tei:figure --> | |
<xsl:template name="render_figure_heading_numbered"> | |
<xsl:param name="abbreviate" as="xs:boolean" select="false()"/> | |
<xsl:apply-templates mode="figure_nr_prefix" select="."/> | |
<xsl:for-each select="tei:head"> | |
<xsl:call-template name="render_heading"> | |
<xsl:with-param name="abbreviate" select="$abbreviate"/> | |
</xsl:call-template> | |
</xsl:for-each> | |
</xsl:template> | |
<!-- context: chapter/section/subsection --> | |
<xsl:template name="render_section_heading_numbered"> | |
<xsl:param name="abbreviate" as="xs:boolean" select="false()"/> | |
<xsl:apply-templates mode="section_nr_prefix" select="."/> | |
<xsl:for-each select="tei:head"> | |
<xsl:call-template name="render_heading"> | |
<xsl:with-param name="abbreviate" select="$abbreviate"/> | |
</xsl:call-template> | |
</xsl:for-each> | |
</xsl:template> | |
<xsl:template name="render_heading"> | |
<xsl:param name="abbreviate" as="xs:boolean" select="false()"/> | |
<xsl:choose> | |
<xsl:when test="tei:choice/tei:abbr and $abbreviate"> | |
<xsl:apply-templates mode="inline" select="tei:choice/tei:abbr/node()"/> | |
</xsl:when> | |
<xsl:when test="tei:choice/tei:expan"> | |
<xsl:apply-templates mode="inline" select="tei:choice/tei:expan/node()"/> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:apply-templates mode="inline"/> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:template> | |
<xsl:template name="render_paragraph_container" as="element(div)"> | |
<xsl:param name="content" as="node()*"/> | |
<xsl:param name="url_icon" as="xs:boolean" select="true()" tunnel="yes"/> | |
<xsl:param name="id" as="xs:boolean" select="true()" tunnel="yes"/> | |
<xsl:param name="indices" as="element(eoa:index)*" tunnel="yes"/> | |
<xsl:variable name="container_id" as="xs:string"><xsl:call-template name="container_id"/></xsl:variable> | |
<xsl:variable name="chapter_id"><xsl:call-template name="chapter_id"/></xsl:variable> | |
<xsl:variable name="uri"><xsl:call-template name="full_uri_from_chapter"/></xsl:variable> | |
<xsl:variable name="index_elems" as="element(eoa:term)*" | |
select="$indices//eoa:term[eoa:entry/eoa:link[eoa:entry[3] = $chapter_id and eoa:entry[4] = $container_id]]" | |
/> | |
<xsl:if test="$index_elems"> | |
<xsl:sequence select="eoa:debug(concat('container has INDEX: ', string-join($index_elems/eoa:title, ',')))"/> | |
</xsl:if> | |
<xsl:call-template name="accordion_row"> | |
<xsl:with-param name="url_icon_content" select="if ($url_icon) then $uri else ()"/> | |
<xsl:with-param name="id" select="if ($id) then $container_id else ()"/> | |
<xsl:with-param name="eye_icon_content"> | |
<xsl:call-template name="render_eye_content"> | |
<xsl:with-param name="current_id" as="xs:string" select="$container_id"/> | |
<xsl:with-param name="index_elems" as="element(eoa:term)*" select="$index_elems"/> | |
</xsl:call-template> | |
</xsl:with-param> | |
<xsl:with-param name="content" as="node()*" select="$content"/> | |
</xsl:call-template> | |
</xsl:template> | |
<xsl:template name="accordion_row"> | |
<xsl:param name="url_icon_content" as="xs:string?"/> | |
<xsl:param name="eye_icon_content" as="xs:string?"/> | |
<xsl:param name="id" as="xs:string?"/> | |
<xsl:param name="content" as="node()*"/> | |
<div class="row" id="{$id}"> | |
<xsl:variable name="flags" as="element()*"> | |
<xsl:if test="$url_icon_content"> | |
<xsl:variable name="data_content" as="xs:string" | |
select="concat('If you want to directly link to this paragraphin the text, you can use the following URL:<br/> <a href=', $apos, $url_icon_content, $apos, '> ', $url_icon_content,'</a>')" | |
/> | |
<button class="icon-bookmark publications-popup" data-content="{$data_content}" title="" rel="popover" data-title="Permanent Link"></button> | |
</xsl:if> | |
<xsl:if test="$eye_icon_content"> | |
<button class="icon-bookmark publications-popup-eye" data-content="{$eye_icon_content}" title="" rel="popover" data-title="Keywords, Persons and Locations"></button> | |
</xsl:if> | |
</xsl:variable> | |
<xsl:if test="$flags"> | |
<div class="flags"> | |
<xsl:copy-of select="$flags"/> | |
</div> | |
</xsl:if> | |
<xsl:copy-of select="$content"/> | |
</div> | |
</xsl:template> | |
<xsl:template name="render_eye_content"> | |
<xsl:param name="current_id" as="xs:string"/> | |
<xsl:param name="index_elems" as="element(eoa:term)*"/> | |
<xsl:for-each select="$index_elems"> | |
<xsl:variable name="heading"> | |
<xsl:for-each select="ancestor-or-self::eoa:term"> | |
<xsl:value-of select="eoa:title"/> | |
<xsl:if test="position() != last()"> | |
<xsl:text> - </xsl:text> | |
</xsl:if> | |
</xsl:for-each> | |
</xsl:variable> | |
<xsl:value-of select="$heading"/> | |
<xsl:if test="count(eoa:entry) > 1"> | |
<xsl:text> </xsl:text> | |
<xsl:for-each select="eoa:entry"> | |
<xsl:choose> | |
<xsl:when test="eoa:link/eoa:entry[last()] = $current_id"> | |
<![CDATA[<span>]]> | |
<xsl:value-of select="position()"/> | |
<![CDATA[</span>]]> | |
</xsl:when> | |
<xsl:otherwise> | |
<![CDATA[<a href="]]><xsl:value-of select=" | |
concat( | |
'../', | |
string-join(eoa:link/eoa:entry[position()>2 and position() != last()],'/'), | |
'/index.html#', eoa:link/eoa:entry[last()] | |
) | |
"/><![CDATA[">]]> | |
<xsl:value-of select="position()"/> | |
<![CDATA[</a>]]> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:for-each> | |
</xsl:if> | |
<xsl:if test="position() != last()"> | |
<![CDATA[<br/>]]> | |
</xsl:if> | |
</xsl:for-each> | |
</xsl:template> | |
</xsl:stylesheet> |