diff --git a/src/main/resources/db2xhtml.xsl b/src/main/resources/db2xhtml.xsl index 9c26486b95b3d057878f0a99bb55c28bfb28f272..cb42fd319889aa9d03d2baf3cfd91b3ada7d00bf 100644 --- a/src/main/resources/db2xhtml.xsl +++ b/src/main/resources/db2xhtml.xsl @@ -1,11 +1,538 @@ <?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" - xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:tei="http://www.tei-c.org/ns/1.0" - xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:tgs="http://www.textgrid.info/namespaces/middleware/tgsearch" - exclude-result-prefixes="xs tei tgs xi" xpath-default-namespace="http://www.tei-c.org/ns/1.0" - version="2.0"> - - <xsl:import href="/usr/share/xml/tei/stylesheet/xhtml2/tei.xsl" /> -</xsl:stylesheet> - \ No newline at end of file +<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tgs="http://www.textgrid.info/namespaces/middleware/tgsearch" exclude-result-prefixes="xs tei tgs xi" xpath-default-namespace="http://www.tei-c.org/ns/1.0" version="2.0"> + + <xsl:import href="/usr/share/xml/tei/stylesheet/xhtml2/tei.xsl"/> +<!-- <xsl:import href="/db/xslt/tei/xhtml2/tei.xsl"/> --> + + + <!-- graphicsURLPattern == URL to use for graphics inclusion, i.e. get raw data. + The stylesheet will replace @URI@ with the actual URI reference and then + + --> + <xsl:param name="graphicsURLPattern">http://textgridlab.org/1.0/tgcrud/rest/@URI@/data</xsl:param> + <xsl:param name="linkURLPattern">http://textgridlab.org/1.0/tgcrud/rest/@URI@/data</xsl:param> + + <!-- FIXME TODO document params to stylesheet --> + <xsl:param name="verbose">false</xsl:param> + <xsl:param name="graphicsPrefix"/> + <xsl:param name="graphicsSuffix"/> + <xsl:param name="parentURL"/> + <xsl:param name="URLPREFIX"/> + <xsl:param name="documentationLanguage"/> + <xsl:param name="homeLabel">TextGridRep</xsl:param> + <xsl:param name="homeURL">http://www.textgridrep.de/</xsl:param> + <xsl:param name="homeWords">TextGrid</xsl:param> + <xsl:param name="institution"/> + <xsl:param name="searchURL">/tgrep/index.html</xsl:param> + <xsl:param name="linkPanel">false</xsl:param> + <xsl:param name="numberHeadings">false</xsl:param> + <xsl:param name="autoToc">false</xsl:param> + <xsl:param name="autoHead">false</xsl:param> + <xsl:param name="showTitleAuthor">false</xsl:param> + <xsl:param name="cssFile">css/tei.css</xsl:param> + + +<!-- + XInclude processing – I think we don't need to support this any longer + <xsl:variable name="include-ids"> + <xsl:for-each select="//xi:include/@href[starts-with(., 'textgrid:')]"> + <xsl:value-of select="substring(., 10)"/> + <xsl:if test="../following::xi:include[@href]">,</xsl:if> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="include-titles"> + <xsl:if test="$include-ids"> + <!-\- <xsl:message>Fetching IDs: <xsl:value-of select="$include-ids"/>.</xsl:message> -\-> + <xsl:copy-of select="document(concat('http://134.76.20.76:8086/exist/rest/generic/query/get-title.xql?uris=', $include-ids))"/> + </xsl:if> + </xsl:variable> + <xsl:output method="xhtml" indent="yes"/> +--> + <!-- XXXX Enabling the following template breaks the Portal (xslt: embedded view not possible, click HERE) --> + <!-- + <xsl:template match="titleStmt/title"> + <xsl:comment> + Title: <xsl:apply-templates/> + </xsl:comment> + </xsl:template> + --> + + + <!-- Copied from textstucture.xsl to remove the extra heading from the titleStmt --> + <xsl:template name="stdheader"> + <xsl:param name="title">(no title)</xsl:param> + </xsl:template> + + <!-- subtler page references --> + <xsl:template match="pb"> + <span class="pagebreak" title="{concat('Page ', @n)}">[<xsl:value-of select="@n"/>]</span> + </xsl:template> + + <!-- copied and modified from the TEI's xhtml2/textstructure.xsl, which produces empty <hn> elements even when autoHead is off + <xsl:template name="doDivBody"> + <xsl:param name="Depth"/> + <xsl:call-template name="startDivHook"/> + <xsl:variable name="ident"> + <xsl:apply-templates mode="ident" select="."/> + </xsl:variable> + <xsl:choose> + <xsl:when test="parent::tei:*/@rend='multicol'"> + <td valign="top"> + <xsl:if test="not($Depth = '') and ($autoHead = 'true' or head)"> + <xsl:element name="h{$Depth + $divOffset}"> + <xsl:for-each select="tei:head[1]"> + <xsl:call-template name="rendToClass"> + <xsl:with-param name="default"/> + </xsl:call-template> + </xsl:for-each> + <xsl:call-template name="header"> + <xsl:with-param name="display">full</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="sectionHeadHook"/> + </xsl:element> + </xsl:if> + <xsl:apply-templates/> + </td> + </xsl:when> + <xsl:when test="@rend='multicol'"> + <xsl:apply-templates select="*[not(local-name(.)='div')]"/> + <table> + <tr> + <xsl:apply-templates select="tei:div"/> + </tr> + </table> + </xsl:when> + <xsl:when test="@rend='nohead'"> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> + <xsl:if test="not($Depth = '') and ($autoHead = 'true' or head)"> + <xsl:element name="h{$Depth + $divOffset}"> + <xsl:choose> + <xsl:when test="@rend"> + <xsl:call-template name="rendToClass"> + <xsl:with-param name="id">false</xsl:with-param> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="tei:head[1]"> + <xsl:call-template name="rendToClass"> + <xsl:with-param name="default"/> + </xsl:call-template> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="header"> + <xsl:with-param name="display">full</xsl:with-param> + </xsl:call-template> + <xsl:call-template name="sectionHeadHook"/> + </xsl:element> + </xsl:if> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + --> + + <xsl:template name="generateTitle"> + <xsl:variable name="result"> + <xsl:choose> + <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle"> + <xsl:apply-templates select="ancestor-or-self::tei:TEI/tei:text/tei:front//tei:docTitle/tei:titlePart"/> + </xsl:when> + <xsl:when test="$useHeaderFrontMatter='true' and ancestor-or-self::tei:teiCorpus/tei:text/tei:front//tei:docTitle"> + <xsl:apply-templates select="ancestor-or-self::tei:teiCorpus/tei:text/tei:front//tei:docTitle/tei:titlePart"/> + </xsl:when> + <xsl:when test="self::tei:teiCorpus"> + <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title[not(@type='subordinate')]"/> + </xsl:when> + <xsl:otherwise> + <xsl:for-each select="ancestor-or-self::tei:TEI/tei:teiHeader/tei:fileDesc/tei:titleStmt"> + <xsl:choose> + <xsl:when test="tei:title[@type='main']"> + <xsl:apply-templates select="tei:title"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="tei:title"/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="normalize-space(string($result)) = ''">(no title)</xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$result"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <xsl:template match="desc"> + <xsl:comment> + <xsl:apply-templates/> + </xsl:comment> + </xsl:template> + <xsl:template name="copyrightStatement"> + <xsl:choose> + <xsl:when test="//fileDesc/publicationStmt/availability"> + <div class="copyrightStatement"> + <xsl:apply-templates select="//fileDesc/publicationStmt/availability"/> + </div> + </xsl:when> + </xsl:choose> + </xsl:template> + + <!-- copied and simplyfied from TEI's xhtml2/textstructure.xsl to adapt for our needs --> + <xsl:template name="stdfooter"> + <xsl:param name="style" select="'plain'"/> + <xsl:param name="file"/> + <div class="stdfooter"> + <xsl:if test="$linkPanel='true'"> + <div class="footer"> + <xsl:if test="not($parentURL='')"> + <a class="{$style}" href="{$parentURL}"> + <xsl:value-of select="$parentWords"/> + </a> | </xsl:if> + <a class="{$style}" href="{$homeURL}"> + <xsl:value-of select="$homeWords"/> + </a> + <xsl:if test="$searchURL"> + <xsl:text>| </xsl:text> + <a class="{$style}" href="{$searchURL}"> + <xsl:call-template name="i18n"> + <xsl:with-param name="word">searchWords</xsl:with-param> + </xsl:call-template> + </a> + </xsl:if> + <xsl:if test="$feedbackURL"> | <a class="{$style}" href="{$feedbackURL}"> + <xsl:call-template name="i18n"> + <xsl:with-param name="word">feedbackWords</xsl:with-param> + </xsl:call-template> + </a> + </xsl:if> + </div> + </xsl:if> + <address> + <xsl:call-template name="copyrightStatement"/> + <xsl:comment> + <xsl:text> + Generated </xsl:text> + <xsl:if test="not($masterFile='index')"> + <xsl:text>from </xsl:text> + <xsl:value-of select="$masterFile"/> + </xsl:if> + <xsl:text> using an XSLT version </xsl:text> + <xsl:value-of select="system-property('xsl:version')"/> stylesheet + based on <xsl:value-of select="$teixslHome"/> + processed using <xsl:value-of select="system-property('xsl:vendor')"/> + on <xsl:call-template name="whatsTheDate"/> + </xsl:comment> + </address> + </div> + </xsl:template> + + <!-- This has been taken from xhtml2/figures.xsl to allow handling textgrid: and hdl: URIs in graphics references. I have only adapted the definition of $File at the beginning of the template, the rest has been copypasted verbatim. --> + <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl"> + <desc>[html] display graphic file</desc> + </doc> + <xsl:template name="showGraphic"> + <xsl:variable name="File"> + <xsl:choose> + <xsl:when test="self::tei:binaryObject"/> + <xsl:when test="@url and ( starts-with(@url, 'textgrid:') or starts-with(@url, 'hdl:'))"> + <xsl:value-of select="replace($graphicsURLPattern, '@URI@', @url)"/> + </xsl:when> + <xsl:when test="@url"> + <xsl:value-of select="@url"/> + <xsl:if test="not(contains(@url,'.'))"> + <xsl:value-of select="$graphicsSuffix"/> + </xsl:if> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes">Cannot work out how to do a graphic, needs a URL</xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="Alt"> + <xsl:choose> + <xsl:when test="tei:desc"> + <xsl:for-each select="tei:desc"> + <xsl:apply-templates mode="plain"/> + </xsl:for-each> + </xsl:when> + <xsl:when test="tei:figDesc"> + <xsl:for-each select="tei:figDesc"> + <xsl:apply-templates mode="plain"/> + </xsl:for-each> + </xsl:when> + <xsl:when test="tei:head"> + <xsl:value-of select="tei:head/text()"/> + </xsl:when> + <xsl:when test="parent::tei:figure/tei:figDesc"> + <xsl:for-each select="parent::tei:figure/tei:figDesc"> + <xsl:apply-templates mode="plain"/> + </xsl:for-each> + </xsl:when> + <xsl:when test="parent::tei:figure/tei:head"> + <xsl:value-of select="parent::tei:figure/tei:head/text()"/> + </xsl:when> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="$showFigures='true'"> + <xsl:choose> + <xsl:when test="@type='thumbnail'"/> + <xsl:when test="starts-with(@mimeType, 'video')"> + <video src="{$graphicsPrefix}{$File}" + controls="controls"> + <xsl:if test="../tei:graphic[@type='thumbnail']"> + <xsl:attribute name="poster"> + <xsl:value-of select="../tei:graphic[@type='thumbnail']/@url"/> + </xsl:attribute> + </xsl:if> + </video> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="sizes"> + <xsl:if test="@width"> + <xsl:text> width:</xsl:text> + <xsl:value-of select="@width"/> + <xsl:text>;</xsl:text> + </xsl:if> + <xsl:if test="@height"> + <xsl:text> height:</xsl:text> + <xsl:value-of select="@height"/> + <xsl:text>;</xsl:text> + </xsl:if> + </xsl:variable> + <xsl:variable name="i"> + <img> + <xsl:attribute name="src"> + <xsl:choose> + <xsl:when test="self::tei:binaryObject"> + <xsl:text>data:</xsl:text> + <xsl:value-of select="@mimetype"/> + <xsl:variable name="enc" select="if (@encoding) then @encoding else 'base64'"/> + <xsl:text>;</xsl:text> + <xsl:value-of select="$enc"/> + <xsl:text>,</xsl:text> + <xsl:copy-of select="text()"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of + select="concat($graphicsPrefix,$File)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="alt"> + <xsl:value-of select="$Alt"/> + </xsl:attribute> + <xsl:call-template name="imgHook"/> + <xsl:if test="@xml:id"> + <xsl:attribute name="id"> + <xsl:value-of select="@xml:id"/> + </xsl:attribute> + </xsl:if> + <xsl:call-template name="makeRendition"/> + </img> + </xsl:variable> + <xsl:for-each select="$i/*"> + <xsl:copy> + <xsl:copy-of select="@*[not(name()='style')]"/> + <xsl:choose> + <xsl:when test="$sizes=''"> + <xsl:copy-of select="@style"/> + </xsl:when> + <xsl:when test="not(@style)"> + <xsl:attribute name="style" select="$sizes"/> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="style" + select="concat(@style,';' ,$sizes)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> + </xsl:for-each> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:otherwise> + <div class="altfigure"> + <xsl:call-template name="i18n"> + <xsl:with-param name="word">figureWord</xsl:with-param> + </xsl:call-template> + <xsl:text> </xsl:text> + <xsl:for-each select="self::tei:figure|parent::tei:figure"> + <xsl:number count="tei:figure[tei:head]" level="any"/> + </xsl:for-each> + <xsl:text> </xsl:text> + <xsl:value-of select="$File"/> + <xsl:text> [</xsl:text> + <xsl:value-of select="$Alt"/> + <xsl:text>] </xsl:text> + </div> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + + + + <!-- Spezialbehandlung für die Zeno-Variante der Fußnoten --> + <xsl:template match="div[@type = 'footnotes']//note"> + <div class="note"> + <xsl:apply-templates/> + </div> + </xsl:template> + <xsl:template match="note[@target]//ref[not(@target or @url)]"> + <a href="{ancestor::note[@target][1]/@target}"> + <xsl:if test="@xml:id"> + <xsl:attribute name="xml:id" select="@xml:id"/> + </xsl:if> + <xsl:apply-templates/> + </a> + </xsl:template> + + + <!-- from xhtml2/linking.xsl TODO + <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl"> + <desc>[html] create external link<param name="ptr">ptr</param> + <param name="dest">dest</param> + <param name="class">class</param> + </desc> + </doc> + <xsl:template name="makeExternalLink"> + <xsl:param name="ptr"/> + <xsl:param name="dest"/> + <xsl:param name="class">link_<xsl:value-of select="local-name(.)"/> + </xsl:param> + <a> + <xsl:choose> + <xsl:when test="@rend"> + <xsl:attribute name="class"> + <xsl:value-of select="@rend"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="@rendition"> + <xsl:call-template name="applyRendition"/> + </xsl:when> + <xsl:when test="parent::tei:item/parent::tei:list[@rend]"> + <xsl:attribute name="class"> + <xsl:value-of select="parent::tei:item/parent::tei:list/@rend"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="parent::tei:item[@rend]"> + <xsl:attribute name="class"> + <xsl:value-of select="parent::tei:item/@rend"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:attribute name="class"> + <xsl:value-of select="$class"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="@type"> + <xsl:attribute name="type"> + <xsl:value-of select="@type"/> + </xsl:attribute> + </xsl:if> + <xsl:attribute name="href"> + <xsl:if test="starts-with($dest, 'textgrid:')"> + <xsl:text>browse.html?id=</xsl:text> + </xsl:if> + <xsl:value-of select="$dest"/> + <xsl:if test="contains(@from,'id (')"> + <xsl:text>#</xsl:text> + <xsl:value-of select="substring(@from,5,string-length(normalize-space(@from))-1)"/> + </xsl:if> + </xsl:attribute> + <xsl:choose> + <xsl:when test="@n"> + <xsl:attribute name="title"> + <xsl:value-of select="@n"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + <xsl:call-template name="xrefHook"/> + <xsl:choose> + <xsl:when test="$dest=''">??</xsl:when> + <xsl:when test="$ptr='true'"> + <xsl:element name="{$urlMarkup}"> + <xsl:choose> + <xsl:when test="starts-with($dest,'mailto:')"> + <xsl:value-of select="substring-after($dest,'mailto:')"/> + </xsl:when> + <xsl:when test="starts-with($dest,'file:')"> + <xsl:value-of select="substring-after($dest,'file:')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$dest"/> + </xsl:otherwise> + </xsl:choose> + </xsl:element> + </xsl:when> + <xsl:when test="not(* | text())"> + <xsl:value-of select="$dest"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> + </a> + </xsl:template> --> + + <!-- + <xsl:template match="xi:include[starts-with(@href, 'textgrid')]"> + <xsl:variable name="href" select="normalize-space(@href)"/> + <xsl:variable name="record" select="$include-titles//tgs:title[@tguri = $href]"/> + <xsl:if test="$record"> + <p> + <a href="browse.html?id={$href}"> + <xsl:value-of select="$record"/> + </a> + </p> + </xsl:if> + </xsl:template> + --> + + <xsl:template match="tei:teiCorpus"> + <html> + <xsl:call-template name="addLangAtt"/> + <head> + <title> + <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title/text()"/> + </title> + <xsl:call-template name="includeCSS"/> + <xsl:call-template name="cssHook"/> + </head> + <body class="simple" id="TOP"> + <xsl:call-template name="bodyHook"/> + <xsl:call-template name="bodyJavascriptHook"/> + <div class="stdheader"> + <xsl:call-template name="stdheader"> + <xsl:with-param name="title"> + <xsl:apply-templates select="tei:teiHeader/tei:fileDesc/tei:titleStmt/tei:title"/> + </xsl:with-param> + </xsl:call-template> + </div> + <xsl:call-template name="corpusBody"/> + <xsl:call-template name="stdfooter"/> + <xsl:call-template name="bodyEndHook"/> + </body> + </html> + </xsl:template> + <xsl:template name="corpusBody"> + <xsl:apply-templates/> + </xsl:template> + <xsl:template match="publicationStmt/availability/p[starts-with(., ' Der annotierte Datenbestand der Digitalen Bibliothek inklusive Metadaten')]"> + <p> + Der annotierte Datenbestand der Digitalen Bibliothek inklusive Metadaten sowie + davon einzeln zugängliche Teile sind eine Abwandlung des Datenbestandes von + www.editura.de durch TextGrid und werden unter der Lizenz Creative Commons + Namensnennung 3.0 Deutschland Lizenz (by-Nennung TextGrid, www.editura.de) veröffentlicht. Die + Lizenz bezieht sich nicht auf die der Annotation zu Grunde liegenden + allgemeinfreien Texte (Siehe auch Punkt 2 der Lizenzbestimmungen). + </p> + </xsl:template> +</xsl:stylesheet> \ No newline at end of file