diff --git a/src/main/webapp/WEB-INF/stylesheets/db2xhtml.xsl b/src/main/webapp/WEB-INF/stylesheets/db2xhtml.xsl index 27c9fac7f30146f0dd29a70fa0b6b02bd328aabb..d5c85ae03aecec0cb7f4d1cb890fe02ca9ee71aa 100644 --- a/src/main/webapp/WEB-INF/stylesheets/db2xhtml.xsl +++ b/src/main/webapp/WEB-INF/stylesheets/db2xhtml.xsl @@ -1,5 +1,11 @@ <?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: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:ge="http://www.tei-c.org/ns/geneticEditions" + 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" + xmlns:f="http://www.faustedition.net/ns" + version="2.0"> <xsl:import href="../tei-stylesheets/html/html.xsl"/> <xsl:include href="tghtml-common.xsl"/> @@ -459,6 +465,107 @@ </p> </xsl:template> + + <xsl:template match="g"> + <xsl:variable name="def" select="document(@ref)"/> + <span> + <xsl:call-template name="microdata"/> + <xsl:call-template name="makeRendition"> + <xsl:with-param name="default">g</xsl:with-param> + </xsl:call-template> + <xsl:if test="$def/desc"> + <xsl:attribute name="title" select="$def/desc"/> + </xsl:if> + <xsl:if test="$def/(name|charName)"> + <xsl:attribute name="data-name" select="$def/(name|charName)"/> + </xsl:if> + <xsl:choose> + <xsl:when test="text() and string-length(text()) > 0"> + <xsl:value-of select="text()"/> + </xsl:when> + <xsl:when test="$def/mapping[string-length(.) > 0]"> + <xsl:value-of select="$def/mapping[string-length(.) > 0][1]"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>⯑</xsl:text> + <xsl:comment>could not expand character <xsl:value-of select="@ref"/></xsl:comment> + </xsl:otherwise> + </xsl:choose> + </span> + </xsl:template> + + <xsl:template match="handShift"> + <xsl:variable name="handNote" select="document(@new)"/> + <span class="handShift" data-new="{@new}" title="✍ {string($handNote)}">✍</span> + </xsl:template> + + <!-- Faust GE stuff: TODO move to external stylesheet --> + + <xsl:template name="startHook"> + <xsl:apply-templates select="ge:document"/> + </xsl:template> + + <xsl:template match="ge:document"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="ge:surface"> + <xsl:call-template name="makeBlock"> + <xsl:with-param name="element">div</xsl:with-param> + <xsl:with-param name="style">surface</xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="ge:line"> + <xsl:call-template name="makeBlock"> + <xsl:with-param name="element">div</xsl:with-param> + <xsl:with-param name="style">line ge-line</xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="f:vspace"> + <br class="vspace" data-quantity="{@quantity}" data-unit="{@unit}" style="line-height: {@quantity * 100}%"/> + </xsl:template> + + <xsl:template match="f:st"> + <xsl:call-template name="makeInline"> + <xsl:with-param name="style">strikethrough</xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template match="f:*"> + <xsl:call-template name="makeInline"> + <xsl:with-param name="style" select="concat('faust_', local-name(.))"/> + </xsl:call-template> + </xsl:template> + + <xsl:template match="ge:*"> + <xsl:call-template name="makeInline"> + <xsl:with-param name="style" select="concat('ge_', local-name(.))"/> + </xsl:call-template> + </xsl:template> + + + <!-- taken from html.xsl, added the option to override the element via parameter --> + <xsl:template name="makeBlock"> + <xsl:param name="style"/> + <xsl:param name="element" select="if (tei:is-inline(.)) then 'span' else 'div'"/> + <xsl:element name="{$element}"> + <xsl:call-template name="microdata"/> + <xsl:call-template name="makeRendition"> + <xsl:with-param name="default" select="$style"/> + </xsl:call-template> + <xsl:if test="@xml:id"> + <xsl:attribute name="id"> + <xsl:value-of select="@xml:id"/> + </xsl:attribute> + </xsl:if> + <xsl:if test="@hand"> + <span class="handShift" data-new="{@hand}" title="✍ {string(document(@hand))}">✍</span> + </xsl:if> + <xsl:apply-templates/> + </xsl:element> + </xsl:template> </xsl:stylesheet>