From ae2833b177e4c3d61858d49596a9a285afa45806 Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Wed, 21 Jun 2017 23:14:09 +0200 Subject: [PATCH] Handling <imagedata> @valign --- ws/Docbook/CustomLayer/slide/slideHdm.xsl | 33 ++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/ws/Docbook/CustomLayer/slide/slideHdm.xsl b/ws/Docbook/CustomLayer/slide/slideHdm.xsl index e2c5f654c..c12c76a2b 100644 --- a/ws/Docbook/CustomLayer/slide/slideHdm.xsl +++ b/ws/Docbook/CustomLayer/slide/slideHdm.xsl @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" - xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:simg="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.ImageIntrinsics" + xmlns:ximg="xalan://com.nwalsh.xalan.ImageIntrinsics" xmlns:d="http://docbook.org/ns/docbook"> <xsl:import href="../../docbook-xsl/xhtml/chunk.xsl"/> @@ -111,6 +113,31 @@ </xsl:template> + <!-- Hack: Docbook XSL does not handle @valign in images--> + + <xsl:template match="d:mediaobject[d:imageobject/d:imagedata[@valign]]"> + <img src="{d:imageobject/d:imagedata/@fileref}"> + <xsl:attribute name="style"> + <xsl:variable name="dbValign" select="d:imageobject/d:imagedata/@valign"/> + + <xsl:text>vertical-align: </xsl:text> + <xsl:choose> + <xsl:when test="$dbValign = 'top'">text-top</xsl:when> + <xsl:when test="$dbValign = 'middle'">middle</xsl:when> + <xsl:when test="$dbValign = 'bottom'">text-bottom</xsl:when> + <xsl:otherwise> + <xsl:message> + <xsl:text>Unknown @valign value: </xsl:text> + <xsl:value-of select="$dbValign"/> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + </img> + + + </xsl:template> + <!-- <xsl:template match="d:section"> <xsl:param name="titleset"/> <xsl:variable name="extendedTitleset" select="$titleset|d:title"/> @@ -155,4 +182,8 @@ </h4> </xsl:template> --> + + + + </xsl:stylesheet> -- GitLab