From 480dcce8cff6b5cff314ba01c41760a15b6d155e Mon Sep 17 00:00:00 2001
From: Martin Goik <goik@hdm-stuttgart.de>
Date: Wed, 27 Jul 2022 09:39:25 +0200
Subject: [PATCH] Resolving highlight.js crash issue

---
 .../slide/slideAssets/css/extra.css           |   15 +
 .../slide/slideAssets/js/docbookSupp.js       |   47 +-
 ws/Docbook/CustomLayer/slide/xsl/slideHdm.xsl | 1307 ++++++++---------
 ws/Docbook/Preprocess/make.rules              |    2 +-
 4 files changed, 701 insertions(+), 670 deletions(-)
 create mode 100644 ws/Docbook/CustomLayer/slide/slideAssets/css/extra.css

diff --git a/ws/Docbook/CustomLayer/slide/slideAssets/css/extra.css b/ws/Docbook/CustomLayer/slide/slideAssets/css/extra.css
new file mode 100644
index 000000000..afa161bdb
--- /dev/null
+++ b/ws/Docbook/CustomLayer/slide/slideAssets/css/extra.css
@@ -0,0 +1,15 @@
+.header-left {
+   position: absolute;
+   top: 0%;
+   left: 0%;
+}
+.header-right {
+   position: absolute;
+   top: 0%;
+   right: 0%;
+}
+.footer-center {
+   position: absolute;
+   bottom: 0%;
+   left: 40%;
+}
\ No newline at end of file
diff --git a/ws/Docbook/CustomLayer/slide/slideAssets/js/docbookSupp.js b/ws/Docbook/CustomLayer/slide/slideAssets/js/docbookSupp.js
index b0f136bdc..16b510435 100644
--- a/ws/Docbook/CustomLayer/slide/slideAssets/js/docbookSupp.js
+++ b/ws/Docbook/CustomLayer/slide/slideAssets/js/docbookSupp.js
@@ -1,15 +1,46 @@
 Reveal.initialize({
-    center: true,
+    controls: true,
+    progress: true,
     history: true,
-    width: '100%',
-    height: '100%',
-    plugins: [ RevealHighlight ],
-    // transition: 'slide',
-    // transitionSpeed: 'slow',
-    // backgroundTransition: 'slide'
-});
+    center: true,
+    width: '70%',
+    margin: 0.0,
 
+    transition: 'none', // none/fade/slide/convex/concave/zoom
 
+    math: {
+        mathjax: 'mathjax/MathJax.js',
+        config: 'TeX-AMS-MML_HTMLorMML',  // See http://docs.mathjax.org/en/latest/config-files.html
+    },
+    // Optional reveal.js plugins
+    dependencies: [
+        {
+            src: 'reveal.js/lib/js/classList.js', condition: function () {
+                return !document.body.classList;
+            }
+        },
+        {
+            src: 'reveal.js/plugin/markdown/marked.js', condition: function () {
+                return !!document.querySelector('[data-markdown]');
+            }
+        },
+        {
+            src: 'reveal.js/plugin/markdown/markdown.js', condition: function () {
+                return !!document.querySelector('[data-markdown]');
+            }
+        },
+        {
+            src: 'https://freedocs.mi.hdm-stuttgart.de/lib/highlight.js/highlight.js',
+            async: true,
+            callback: function () {
+                hljs.initHighlightingOnLoad();
+            }
+        },
+        {src: 'reveal.js/plugin/zoom-js/zoom.js', async: true},
+        {src: 'reveal.js/plugin/notes/notes.js', async: true},
+        {src: 'reveal.js/plugin/math/math.js', async: true}
+    ]
+});
 
 Reveal.addEventListener('slidechanged', function (event) {
     $.currHeaderId = '#__HEADER_' + event.currentSlide.getAttribute("id");
diff --git a/ws/Docbook/CustomLayer/slide/xsl/slideHdm.xsl b/ws/Docbook/CustomLayer/slide/xsl/slideHdm.xsl
index 084645625..7f521497a 100644
--- a/ws/Docbook/CustomLayer/slide/xsl/slideHdm.xsl
+++ b/ws/Docbook/CustomLayer/slide/xsl/slideHdm.xsl
@@ -1,130 +1,123 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
-  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:d="http://docbook.org/ns/docbook"
-  xmlns="http://www.w3.org/1999/xhtml">
+                xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:d="http://docbook.org/ns/docbook"
+                xmlns="http://www.w3.org/1999/xhtml">
 
-  <xsl:import href="/usr/share/hdm-docbook-xsl/docbook-xsl/xhtml/chunk.xsl"/>
-  <xsl:import href="/usr/share/hdm-docbook-xsl/docbook-xsl/xhtml/highlight.xsl"/>
-  <xsl:import href="/usr/share/hdm-docbook-xsl/docbook-xsl/webhelp/xsl/webhelp-common.xsl"/>
-  <xsl:import href="/usr/share/hdm-docbook-xsl/docbook-xsl/webhelp/xsl/titlepage.templates.xsl"/>
+    <xsl:import href="/usr/share/hdm-docbook-xsl/docbook-xsl/xhtml/chunk.xsl"/>
+    <xsl:import href="/usr/share/hdm-docbook-xsl/docbook-xsl/xhtml/highlight.xsl"/>
+    <xsl:import href="/usr/share/hdm-docbook-xsl/docbook-xsl/webhelp/xsl/webhelp-common.xsl"/>
+    <xsl:import href="/usr/share/hdm-docbook-xsl/docbook-xsl/webhelp/xsl/titlepage.templates.xsl"/>
 
-  <xsl:import href="/usr/share/hdm-docbook-xsl/CustomLayer/Common/common.xsl"/>
-  <xsl:import href="/usr/share/hdm-docbook-xsl/Preprocess/Xsl/slideReference.xsl"/>
+    <xsl:import href="/usr/share/hdm-docbook-xsl/CustomLayer/Common/common.xsl"/>
+    <xsl:import href="/usr/share/hdm-docbook-xsl/Preprocess/Xsl/slideReference.xsl"/>
 
-  <xsl:variable name="topicLookup" select="document('topics.tid.xml', .)"/>
+    <xsl:variable name="topicLookup" select="document('topics.tid.xml', .)"/>
 
-  <xsl:template match="/">
-    <xsl:apply-templates
-      select="
+    <xsl:template match="/">
+        <xsl:apply-templates
+                select="
         (//d:chapter | //d:section | //d:appendix)[contains(@annotations, 'slide') or
         descendant::*[contains(@annotations, 'slide')]]"
-      mode="slideUnit"/>
-  </xsl:template>
+                mode="slideUnit"/>
+    </xsl:template>
+
+    <xsl:template name="createBreadcrumbHierarchy">
+        <xsl:param name="nodes"/>
+        <xsl:param name="currentPosition"/>
+        <ul>
+            <li style="list-style-type: none;">
+
+                <xsl:if test="not($currentPosition = 1)">
+                    <xsl:text>➟ </xsl:text>
+                </xsl:if>
+
+                <xsl:apply-templates
+                        select="$nodes[$currentPosition]/d:title/text() | $nodes[$currentPosition]/d:title/*"/>
+
+                <xsl:choose>
+                    <xsl:when test="$currentPosition &lt; count($nodes)">
+                        <xsl:variable name="nextPosition" select="$currentPosition + 1"/>
+                        <xsl:call-template name="createBreadcrumbHierarchy">
+                            <xsl:with-param name="nodes" select="$nodes"/>
+                            <xsl:with-param name="currentPosition" select="$nextPosition"/>
+                        </xsl:call-template>
+                    </xsl:when>
+
+                    <xsl:otherwise>
+                        <div class="slideSectionOverview">
+                            <xsl:apply-templates select="$nodes[$currentPosition]/d:info/d:abstract/d:para"/>
+                        </div>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </li>
+        </ul>
+    </xsl:template>
+
+    <xsl:template name="createTooltipBreadcrumbHierarchy">
+        <xsl:param name="nodes"/>
+        <xsl:param name="currentPosition"/>
+        <ul>
+            <xsl:if test="$currentPosition = 1">
+                <xsl:attribute name="class">tooltiptext</xsl:attribute>
+            </xsl:if>
 
-  <xsl:template name="createBreadcrumbHierarchy">
-    <xsl:param name="nodes"/>
-    <xsl:param name="currentPosition"/>
-    <ul>
-      <li style="list-style-type: none;">
+            <li style="list-style-type: none;">
+                <xsl:if test="not($currentPosition = 1)">
+                    <xsl:text>➟ </xsl:text>
+                </xsl:if>
+
+                <xsl:apply-templates
+                        select="$nodes[$currentPosition]/d:title/text() | $nodes[$currentPosition]/d:title/*"/>
+
+                <xsl:if test="$currentPosition &lt; count($nodes)">
+                    <xsl:variable name="nextPosition" select="$currentPosition + 1"/>
+                    <xsl:call-template name="createTooltipBreadcrumbHierarchy">
+                        <xsl:with-param name="nodes" select="$nodes"/>
+                        <xsl:with-param name="currentPosition" select="$nextPosition"/>
+                    </xsl:call-template>
+                </xsl:if>
+            </li>
+        </ul>
+    </xsl:template>
+
+    <xsl:template match="d:chapter | d:section | d:appendix" mode="slideUnit">
+
+        <xsl:variable name="slideFileName">
+            <xsl:call-template name="slideFilename">
+                <xsl:with-param name="slideContainerId" select="@xml:id"/>
+            </xsl:call-template>
+        </xsl:variable>
 
-        <xsl:if test="not($currentPosition = 1)">
-          <xsl:text>➟ </xsl:text>
-        </xsl:if>
+        <!-- Writing slide series -->
 
-        <xsl:apply-templates
-          select="$nodes[$currentPosition]/d:title/text() | $nodes[$currentPosition]/d:title/*"/>
+        <xsl:document href="{$slideFileName}" method="html" encoding="utf-8" indent="yes"
+                      doctype-system="none">
 
-        <xsl:choose>
-          <xsl:when test="$currentPosition &lt; count($nodes)">
-            <xsl:variable name="nextPosition" select="$currentPosition + 1"/>
-            <xsl:call-template name="createBreadcrumbHierarchy">
-              <xsl:with-param name="nodes" select="$nodes"/>
-              <xsl:with-param name="currentPosition" select="$nextPosition"/>
-            </xsl:call-template>
-          </xsl:when>
+            <html>
+                <head>
+                    <meta charset="utf-8"/>
+                    <title>
+                        <xsl:value-of select="d:title"/>
+                    </title>
 
-          <xsl:otherwise>
-            <div class="slideSectionOverview">
-              <xsl:apply-templates select="$nodes[$currentPosition]/d:info/d:abstract/d:para"/>
-            </div>
-          </xsl:otherwise>
-        </xsl:choose>
-      </li>
-    </ul>
-  </xsl:template>
-
-  <xsl:template name="createTooltipBreadcrumbHierarchy">
-    <xsl:param name="nodes"/>
-    <xsl:param name="currentPosition"/>
-    <ul>
-      <xsl:if test="$currentPosition = 1">
-        <xsl:attribute name="class">tooltiptext</xsl:attribute>
-      </xsl:if>
-
-      <li style="list-style-type: none;">
-        <xsl:if test="not($currentPosition = 1)">
-          <xsl:text>➟ </xsl:text>
-        </xsl:if>
+                    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
+                    <link href="reveal.js/css/reveal.css" rel="stylesheet"/>
+                    <link href="reveal.js/css/theme/serif.css" id="theme" rel="stylesheet"/>
+                    <link href="reveal.js/lib/css/zenburn.css" rel="stylesheet"/>
+                    <link rel="stylesheet" href="reveal.js/css/idea.min.css"/>
 
-        <xsl:apply-templates
-          select="$nodes[$currentPosition]/d:title/text() | $nodes[$currentPosition]/d:title/*"/>
-
-        <xsl:if test="$currentPosition &lt; count($nodes)">
-          <xsl:variable name="nextPosition" select="$currentPosition + 1"/>
-          <xsl:call-template name="createTooltipBreadcrumbHierarchy">
-            <xsl:with-param name="nodes" select="$nodes"/>
-            <xsl:with-param name="currentPosition" select="$nextPosition"/>
-          </xsl:call-template>
-        </xsl:if>
-      </li>
-    </ul>
-  </xsl:template>
-
-  <xsl:template match="d:chapter | d:section | d:appendix" mode="slideUnit">
-
-    <xsl:variable name="slideFileName">
-      <xsl:call-template name="slideFilename">
-        <xsl:with-param name="slideContainerId" select="@xml:id"/>
-      </xsl:call-template>
-    </xsl:variable>
-
-    <!-- Writing slide series -->
-
-    <xsl:document href="{$slideFileName}" method="html" encoding="utf-8" indent="yes"
-      doctype-system="none">
-
-      <html>
-        <head>
-          <meta charset="utf-8"/>
-          <title>
-            <xsl:value-of select="d:title"/>
-          </title>
-          <link rel="stylesheet" href="reveal.js/css/reveal.css"></link>
-          <link rel="stylesheet" href="reveal.js/css/theme/white.css" id="theme"></link>
-
-          <style media="screen">
-            .slides section.has-dark-background,
-            .slides section.has-dark-background h3 {
-            color: #fff;
-            }
-
-            .slides section.has-light-background,
-            .slides section.has-light-background h3 {
-            color: #222;
-            }
-          </style>
-
-          <link href="slideAssets/css/positioning.css" rel="stylesheet"/>
-          <link href="slideAssets/css/tooltips.css" rel="stylesheet"/>
-        </head>
-
-        <body>
-          <!-- Wrap the entire slide show in a div using the "reveal" class. -->
-          <div class="reveal">
-            <!-- Wrap all slides in a single "slides" class -->
-
-            <xsl:variable name="revealSections"
-              select="
+                    <link href="slideAssets/css/positioning.css" rel="stylesheet"/>
+                    <link href="slideAssets/css/tooltips.css" rel="stylesheet"/>
+                    <link href="slideAssets/css/extra.css" rel="stylesheet"/>
+                </head>
+
+                <body>
+                    <!-- Wrap the entire slide show in a div using the "reveal" class. -->
+                    <div class="reveal">
+                        <!-- Wrap all slides in a single "slides" class -->
+
+                        <xsl:variable name="revealSections"
+                                      select="
                 
                 .//d:figure[not(ancestor::d:qandaset)] |
                 
@@ -132,622 +125,614 @@
                 descendant-or-self::d:section |
                 descendant-or-self::d:appendix)[d:figure[not(ancestor::d:qandaset)]]"/>
 
-            <xsl:apply-templates select="$revealSections" mode="slideRootHeaders"/>
+                        <xsl:apply-templates select="$revealSections" mode="slideRootHeaders"/>
 
-            <div class="slides">
-              <xsl:apply-templates select="$revealSections" mode="slideRootSections"/>
-            </div>
-          </div>
+                        <div class="slides">
+                            <xsl:apply-templates select="$revealSections" mode="slideRootSections"/>
+                        </div>
+                    </div>
 
-          <script src="reveal.js/js/reveal.js"/>
-          <script src="reveal.js/plugin/highlight/highlight.js"/>
-          <link rel="stylesheet" href="reveal.js/lib/css/idea.min.css"/>
-          <!--
-          <link rel="stylesheet" href="reveal.js/plugin/highlight/monokai.css"/>
-          <link rel="stylesheet" href="https://freedocs.mi.hdm-stuttgart.de/lib/highlight.js/styles/idea.css"/>
-          -->
+                    <script src="reveal.js/js/reveal.js"/>
+                    <script src="common/jquery/jquery-1.7.2.min.js"/>
+                    <script src="slideAssets/js/docbookSupp.js"/>
+                </body>
+            </html>
+        </xsl:document>
+    </xsl:template>
 
-          <script src="common/jquery/jquery-1.7.2.min.js"/>
-          <script src="slideAssets/js/docbookSupp.js"/>
+    <xsl:template match="d:chapter | d:section | d:appendix" mode="slideRootHeaders">
+        <div id="__HEADER_{@xml:id}" style="display: none;">
 
-        </body>
-      </html>
-    </xsl:document>
-  </xsl:template>
+            <div class="header-left" style="z-index: 1000;">
 
-  <xsl:template match="d:chapter | d:section | d:appendix" mode="slideRootHeaders">
-    <div id="__HEADER_{@xml:id}" style="display: none;">
+                <h3>Overview</h3>
+                <!--
+                <xsl:apply-templates select="d:title"/>
+                -->
+            </div>
 
-      <div class="header-left" style="z-index: 1000;">
+            <div class="footer-center" style="z-index: 1000;">
+                <xsl:apply-templates mode="footer" select="."/>
+            </div>
+        </div>
+    </xsl:template>
+
+    <xsl:template name="generateFollowupQandasetHeaders">
+
+        <xsl:variable name="currentFigureGenerateId" select="generate-id()"/>
+        <xsl:variable name="followupQandasets"
+                      select="following::d:qandaset[generate-id(preceding::d:figure[not(ancestor::d:qandaset)][1]) = $currentFigureGenerateId]"/>
+
+        <xsl:if test="$followupQandasets">
+
+            <div id="__HEADER_{@xml:id}_followupExercise" style="display: none;">
+
+                <div class="header-left" style="z-index: 1000;">
+
+                    <xsl:choose>
+                        <xsl:when test="1 = count($followupQandasets)">
+                            <h3>Followup exercise</h3>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <h3>Followup exercises</h3>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </div>
+
+                <div class="footer-center" style="z-index: 1000;">
+                    <xsl:apply-templates mode="footer" select="."/>
+                </div>
+
+                <!--
+
+                <div class="footer-center" style="z-index: 1000;">
+                  <xsl:choose>
+                    <xsl:when test="1 = count($followupQandasets)">
+                      <p>Related exercise</p>
+                    </xsl:when>
+                    <xsl:otherwise>
+                      <p>Related exercises</p>
+                    </xsl:otherwise>
+                  </xsl:choose>
+                </div>
+              </div>
+              -->
+            </div>
+        </xsl:if>
+    </xsl:template>
 
-        <h3>Overview</h3>
-        <!-- 
-        <xsl:apply-templates select="d:title"/>
-        -->
-      </div>
+    <xsl:template match="d:figure" mode="slideRootHeaders">
 
-      <div class="footer-center" style="z-index: 1000;">
-        <xsl:apply-templates mode="footer" select="."/>
-      </div>
-    </div>
-  </xsl:template>
+        <xsl:variable name="primarySectionId">
+            <xsl:apply-templates mode="id_or_generate_id" select="."/>
+        </xsl:variable>
 
-  <xsl:template name="generateFollowupQandasetHeaders">
+        <xsl:variable name="currentFigure" as="element()*" select="."/>
 
-    <xsl:variable name="currentFigureGenerateId" select="generate-id()"/>
-    <xsl:variable name="followupQandasets"
-      select="following::d:qandaset[generate-id(preceding::d:figure[not(ancestor::d:qandaset)][1]) = $currentFigureGenerateId]"/>
+        <xsl:variable name="figureTitle">
+            <xsl:apply-templates select="d:title"/>
+        </xsl:variable>
 
-    <xsl:if test="$followupQandasets">
+        <xsl:variable name="imgFilerefValue">
+            <xsl:value-of select="d:mediaobject/d:imageobject/d:imagedata/@fileref"/>
+        </xsl:variable>
 
-      <div id="__HEADER_{@xml:id}_followupExercise" style="display: none;">
+        <xsl:variable name="imgPath">
+            <xsl:call-template name="hdm.get.leftmost.of.separator">
+                <xsl:with-param name="path" select="$imgFilerefValue"/>
+                <xsl:with-param name="separator" select="'/'"/>
+            </xsl:call-template>
+        </xsl:variable>
 
-        <div class="header-left" style="z-index: 1000;">
+        <xsl:variable name="imgName">
+            <xsl:value-of select="substring-after($imgFilerefValue, concat($imgPath, '/'))"/>
+        </xsl:variable>
 
-          <xsl:choose>
-            <xsl:when test="1 = count($followupQandasets)">
-              <h3>Followup exercise</h3>
-            </xsl:when>
-            <xsl:otherwise>
-              <h3>Followup exercises</h3>
-            </xsl:otherwise>
-          </xsl:choose>
-        </div>
+        <xsl:variable name="imgStem">
+            <xsl:value-of select="substring-before($imgName, '.')"/>
+        </xsl:variable>
 
-        <div class="footer-center" style="z-index: 1000;">
-          <xsl:apply-templates mode="footer" select="."/>
-        </div>
+        <xsl:variable name="imgExtension">
+            <xsl:value-of select="substring-after($imgName, concat($imgStem, '.'))"/>
+        </xsl:variable>
 
-        <!--
-        
-        <div class="footer-center" style="z-index: 1000;">
-          <xsl:choose>
-            <xsl:when test="1 = count($followupQandasets)">
-              <p>Related exercise</p>
-            </xsl:when>
-            <xsl:otherwise>
-              <p>Related exercises</p>
-            </xsl:otherwise>
-          </xsl:choose>  
-        </div>
-      </div>    
-      -->
-      </div>
-    </xsl:if>
-  </xsl:template>
-
-  <xsl:template match="d:figure" mode="slideRootHeaders">
-
-    <xsl:variable name="primarySectionId">
-      <xsl:apply-templates mode="id_or_generate_id" select="."/>
-    </xsl:variable>
-
-    <xsl:variable name="currentFigure" as="element()*" select="."/>
-
-    <xsl:variable name="figureTitle">
-      <xsl:apply-templates select="d:title"/>
-    </xsl:variable>
-
-    <xsl:variable name="imgFilerefValue">
-      <xsl:value-of select="d:mediaobject/d:imageobject/d:imagedata/@fileref"/>
-    </xsl:variable>
-
-    <xsl:variable name="imgPath">
-      <xsl:call-template name="hdm.get.leftmost.of.separator">
-        <xsl:with-param name="path" select="$imgFilerefValue"/>
-        <xsl:with-param name="separator" select="'/'"/>
-      </xsl:call-template>
-    </xsl:variable>
-
-    <xsl:variable name="imgName">
-      <xsl:value-of select="substring-after($imgFilerefValue, concat($imgPath, '/'))"/>
-    </xsl:variable>
-
-    <xsl:variable name="imgStem">
-      <xsl:value-of select="substring-before($imgName, '.')"/>
-    </xsl:variable>
-
-    <xsl:variable name="imgExtension">
-      <xsl:value-of select="substring-after($imgName, concat($imgStem, '.'))"/>
-    </xsl:variable>
-
-    <xsl:variable name="moduleRootPath">
-      <xsl:for-each select="ancestor::*/@xml:base">
-        <xsl:call-template name="hdm.get.leftmost.of.separator">
-          <xsl:with-param name="path" select="."/>
-          <xsl:with-param name="separator" select="'/'"/>
-        </xsl:call-template>
-        <xsl:text>/</xsl:text>
-      </xsl:for-each>
-    </xsl:variable>
-
-    <xsl:variable name="fullStemPathname">
-      <xsl:value-of select="concat($moduleRootPath, '/', $imgPath, '/', $imgStem)"/>
-    </xsl:variable>
-
-    <xsl:choose>
-      <xsl:when test="$imgExtension = 'multi.svg'">
-
-        <xsl:variable name="imgLayerSet" as="element()*">
-          <xsl:copy-of
-                  select="document(concat($fullStemPathname, '.filenames'), /)/start/file"/>
+        <xsl:variable name="moduleRootPath">
+            <xsl:for-each select="ancestor::*/@xml:base">
+                <xsl:call-template name="hdm.get.leftmost.of.separator">
+                    <xsl:with-param name="path" select="."/>
+                    <xsl:with-param name="separator" select="'/'"/>
+                </xsl:call-template>
+                <xsl:text>/</xsl:text>
+            </xsl:for-each>
         </xsl:variable>
-        <xsl:for-each select="$imgLayerSet/*">
 
-          <xsl:variable name="currentAnimationId">
-            <xsl:choose>
+        <xsl:variable name="fullStemPathname">
+            <xsl:value-of select="concat($moduleRootPath, '/', $imgPath, '/', $imgStem)"/>
+        </xsl:variable>
 
-              <xsl:when test="1 = position()">
-                <xsl:value-of select="$primarySectionId"/>
-              </xsl:when>
+        <xsl:choose>
+            <xsl:when test="$imgExtension = 'multi.svg'">
 
-              <xsl:otherwise>
-                <xsl:value-of select="concat($primarySectionId, '-', position() - 1)"/>
-              </xsl:otherwise>
-            </xsl:choose>
+                <xsl:variable name="imgLayerSet" as="element()*">
+                    <xsl:copy-of
+                            select="document(concat($fullStemPathname, '.filenames'), /)/start/file"/>
+                </xsl:variable>
+                <xsl:for-each select="$imgLayerSet/*">
 
-          </xsl:variable>
+                    <xsl:variable name="currentAnimationId">
+                        <xsl:choose>
 
-          <div id="__HEADER_{$currentAnimationId}" style="display: none;">
+                            <xsl:when test="1 = position()">
+                                <xsl:value-of select="$primarySectionId"/>
+                            </xsl:when>
 
-            <div class="header-left" style="z-index: 1000;" >
-              <xsl:apply-templates select="$currentFigure/d:title"/>
-            </div>
+                            <xsl:otherwise>
+                                <xsl:value-of select="concat($primarySectionId, '-', position() - 1)"/>
+                            </xsl:otherwise>
+                        </xsl:choose>
 
-            <div class="footer-center" style="z-index: 1000;">
-              <xsl:apply-templates select="$currentFigure" mode="footer">
-                <xsl:with-param name="index" select="position()"/>
-                <xsl:with-param name="length" select="last()"/>
-              </xsl:apply-templates>
-            </div>
+                    </xsl:variable>
 
-          </div>
-        </xsl:for-each>
-      </xsl:when>
+                    <div id="__HEADER_{$currentAnimationId}" style="display: none;">
 
-      <xsl:otherwise>
-        <div id="__HEADER_{$primarySectionId}" style="display: none;">
+                        <div class="header-left" style="z-index: 1000;">
+                            <xsl:apply-templates select="$currentFigure/d:title"/>
+                        </div>
 
-          <div class="header-left" style="z-index: 1000;">
-            <xsl:apply-templates select="$currentFigure/d:title"/>
-          </div>
+                        <div class="footer-center" style="z-index: 1000;">
+                            <xsl:apply-templates select="$currentFigure" mode="footer">
+                                <xsl:with-param name="index" select="position()"/>
+                                <xsl:with-param name="length" select="last()"/>
+                            </xsl:apply-templates>
+                        </div>
 
-          <div class="footer-center" style="z-index: 1000;">
-            <xsl:apply-templates select="$currentFigure" mode="footer"/>
-          </div>
+                    </div>
+                </xsl:for-each>
+            </xsl:when>
 
-        </div>
-      </xsl:otherwise>
+            <xsl:otherwise>
+                <div id="__HEADER_{$primarySectionId}" style="display: none;">
+
+                    <div class="header-left" style="z-index: 1000;">
+                        <xsl:apply-templates select="$currentFigure/d:title"/>
+                    </div>
+
+                    <div class="footer-center" style="z-index: 1000;">
+                        <xsl:apply-templates select="$currentFigure" mode="footer"/>
+                    </div>
+
+                </div>
+            </xsl:otherwise>
 
-    </xsl:choose>
+        </xsl:choose>
 
-    <xsl:call-template name="generateFollowupQandasetHeaders"/>
+        <xsl:call-template name="generateFollowupQandasetHeaders"/>
 
-  </xsl:template>
+    </xsl:template>
 
-  <xsl:template match="d:chapter | d:section | d:appendix" mode="slideRootSections">
+    <xsl:template match="d:chapter | d:section | d:appendix" mode="slideRootSections">
 
-    <section id="{@xml:id}">
-      <xsl:call-template name="createBreadcrumbHierarchy">
+        <section id="{@xml:id}">
+            <xsl:call-template name="createBreadcrumbHierarchy">
 
-        <xsl:with-param name="nodes"
-          select="
+                <xsl:with-param name="nodes"
+                                select="
             ancestor-or-self::d:section |
             ancestor-or-self::d:chapter |
             ancestor-or-self::d:appendix"/>
 
-        <xsl:with-param name="currentPosition" select="1"/>
-
-      </xsl:call-template>
-    </section>
-
-  </xsl:template>
-
-  <xsl:template match="d:figure" mode="slideRootSections">
-
-    <xsl:variable name="primarySectionId">
-      <xsl:apply-templates mode="id_or_generate_id" select="."/>
-    </xsl:variable>
-
-    <xsl:variable name="figureTitle">
-      <xsl:apply-templates select="d:title"/>
-    </xsl:variable>
-
-    <xsl:variable name="imgFilerefValue">
-      <xsl:value-of select="d:mediaobject/d:imageobject/d:imagedata/@fileref"/>
-    </xsl:variable>
-
-    <xsl:variable name="imgPath">
-      <xsl:call-template name="hdm.get.leftmost.of.separator">
-        <xsl:with-param name="path" select="$imgFilerefValue"/>
-        <xsl:with-param name="separator" select="'/'"/>
-      </xsl:call-template>
-    </xsl:variable>
-
-    <xsl:variable name="imgName">
-      <xsl:value-of select="substring-after($imgFilerefValue, concat($imgPath, '/'))"/>
-    </xsl:variable>
-
-    <xsl:variable name="imgStem">
-      <xsl:value-of select="substring-before($imgName, '.')"/>
-    </xsl:variable>
-
-    <xsl:variable name="imgExtension">
-      <xsl:value-of select="substring-after($imgName, concat($imgStem, '.'))"/>
-    </xsl:variable>
-
-    <xsl:variable name="moduleRootPath">
-      <xsl:for-each select="ancestor::*/@xml:base">
-        <xsl:call-template name="hdm.get.leftmost.of.separator">
-          <xsl:with-param name="path" select="."/>
-          <xsl:with-param name="separator" select="'/'"/>
-        </xsl:call-template>
-        <xsl:text>/</xsl:text>
-      </xsl:for-each>
-    </xsl:variable>
-
-    <xsl:variable name="fullStemPathname">
-      <xsl:value-of select="concat($moduleRootPath, '/', $imgPath, '/', $imgStem)"/>
-    </xsl:variable>
-
-    <xsl:choose>
-      <xsl:when test="$imgExtension = 'multi.svg'">
-        <xsl:variable name="imgLayerSet" as="element()*">
-            <xsl:copy-of
-                    select="document(concat($fullStemPathname, '.filenames'), /)/start/file"/>
+                <xsl:with-param name="currentPosition" select="1"/>
+
+            </xsl:call-template>
+        </section>
+
+    </xsl:template>
+
+    <xsl:template match="d:figure" mode="slideRootSections">
+
+        <xsl:variable name="primarySectionId">
+            <xsl:apply-templates mode="id_or_generate_id" select="."/>
         </xsl:variable>
-        <section>
-          <xsl:for-each select="$imgLayerSet/*">
 
-            <section>
-              <xsl:choose>
+        <xsl:variable name="figureTitle">
+            <xsl:apply-templates select="d:title"/>
+        </xsl:variable>
 
-                <xsl:when test="1 = position()">
-                  <xsl:attribute name="id">
-                    <xsl:value-of select="$primarySectionId"/>
-                  </xsl:attribute>
-                </xsl:when>
+        <xsl:variable name="imgFilerefValue">
+            <xsl:value-of select="d:mediaobject/d:imageobject/d:imagedata/@fileref"/>
+        </xsl:variable>
 
-                <xsl:otherwise>
-                  <xsl:attribute name="id">
-                    <xsl:value-of select="concat($primarySectionId, '-', position() - 1)"/>
-                  </xsl:attribute>
-                </xsl:otherwise>
-              </xsl:choose>
+        <xsl:variable name="imgPath">
+            <xsl:call-template name="hdm.get.leftmost.of.separator">
+                <xsl:with-param name="path" select="$imgFilerefValue"/>
+                <xsl:with-param name="separator" select="'/'"/>
+            </xsl:call-template>
+        </xsl:variable>
 
-              <div class="mediaobject">
-                <img width="95%"
-                     src="{concat($fullStemPathname, '-', position() - 1, '.svg')}"
-                     alt="Image layer {position()}"/>
-              </div>
-            </section>
-          </xsl:for-each>
-        </section>
+        <xsl:variable name="imgName">
+            <xsl:value-of select="substring-after($imgFilerefValue, concat($imgPath, '/'))"/>
+        </xsl:variable>
 
-      </xsl:when>
+        <xsl:variable name="imgStem">
+            <xsl:value-of select="substring-before($imgName, '.')"/>
+        </xsl:variable>
 
-      <xsl:otherwise>
-        <section id="{$primarySectionId}">
-          <xsl:apply-templates select="*[not(self::d:title)]"/>
-        </section>
-      </xsl:otherwise>
+        <xsl:variable name="imgExtension">
+            <xsl:value-of select="substring-after($imgName, concat($imgStem, '.'))"/>
+        </xsl:variable>
+
+        <xsl:variable name="moduleRootPath">
+            <xsl:for-each select="ancestor::*/@xml:base">
+                <xsl:call-template name="hdm.get.leftmost.of.separator">
+                    <xsl:with-param name="path" select="."/>
+                    <xsl:with-param name="separator" select="'/'"/>
+                </xsl:call-template>
+                <xsl:text>/</xsl:text>
+            </xsl:for-each>
+        </xsl:variable>
+
+        <xsl:variable name="fullStemPathname">
+            <xsl:value-of select="concat($moduleRootPath, '/', $imgPath, '/', $imgStem)"/>
+        </xsl:variable>
+
+        <xsl:choose>
+            <xsl:when test="$imgExtension = 'multi.svg'">
+                <xsl:variable name="imgLayerSet" as="element()*">
+                    <xsl:copy-of
+                            select="document(concat($fullStemPathname, '.filenames'), /)/start/file"/>
+                </xsl:variable>
+                <section>
+                    <xsl:for-each select="$imgLayerSet/*">
+
+                        <section>
+                            <xsl:choose>
+
+                                <xsl:when test="1 = position()">
+                                    <xsl:attribute name="id">
+                                        <xsl:value-of select="$primarySectionId"/>
+                                    </xsl:attribute>
+                                </xsl:when>
+
+                                <xsl:otherwise>
+                                    <xsl:attribute name="id">
+                                        <xsl:value-of select="concat($primarySectionId, '-', position() - 1)"/>
+                                    </xsl:attribute>
+                                </xsl:otherwise>
+                            </xsl:choose>
+
+                            <div class="mediaobject">
+                                <img width="95%"
+                                     src="{concat($fullStemPathname, '-', position() - 1, '.svg')}"
+                                     alt="Image layer {position()}"/>
+                            </div>
+                        </section>
+                    </xsl:for-each>
+                </section>
 
-    </xsl:choose>
+            </xsl:when>
 
-    <xsl:variable name="currentFigureFooter">
-      <xsl:apply-templates select="." mode="footer"/>
-    </xsl:variable>
+            <xsl:otherwise>
+                <section id="{$primarySectionId}">
+                    <xsl:apply-templates select="*[not(self::d:title)]"/>
+                </section>
+            </xsl:otherwise>
 
-    <xsl:call-template name="generateFollowupQandasets"/>
+        </xsl:choose>
 
-  </xsl:template>
+        <xsl:variable name="currentFigureFooter">
+            <xsl:apply-templates select="." mode="footer"/>
+        </xsl:variable>
 
-  <xsl:template match="d:imagedata">
-    <xsl:variable name="baseSupplementDir">
-      <xsl:for-each select="ancestor::*/@xml:base">
-        <xsl:call-template name="hdm.get.leftmost.of.separator">
-          <xsl:with-param name="path" select="."/>
-          <xsl:with-param name="separator" select="'/'"/>
-        </xsl:call-template>
-        <xsl:text>/</xsl:text>
-      </xsl:for-each>
-    </xsl:variable>
+        <xsl:call-template name="generateFollowupQandasets"/>
 
-    <img width="95%" src="{concat($baseSupplementDir, @fileref)}" alt="{ancestor::d:figure/d:title}"
-    />
-  </xsl:template>
+    </xsl:template>
 
-  <xsl:template name="generateFollowupQandasets">
+    <xsl:template match="d:imagedata">
+        <xsl:variable name="baseSupplementDir">
+            <xsl:for-each select="ancestor::*/@xml:base">
+                <xsl:call-template name="hdm.get.leftmost.of.separator">
+                    <xsl:with-param name="path" select="."/>
+                    <xsl:with-param name="separator" select="'/'"/>
+                </xsl:call-template>
+                <xsl:text>/</xsl:text>
+            </xsl:for-each>
+        </xsl:variable>
 
-    <xsl:variable name="currentFigureGenerateId" select="generate-id()"/>
-    <xsl:variable name="followupQandasets"
-      select="following::d:qandaset[generate-id(preceding::d:figure[not(ancestor::d:qandaset)][1]) = $currentFigureGenerateId]"/>
+        <img width="95%" src="{concat($baseSupplementDir, @fileref)}" alt="{ancestor::d:figure/d:title}"
+        />
+    </xsl:template>
 
-    <xsl:if test="$followupQandasets">
+    <xsl:template name="generateFollowupQandasets">
 
-      <xsl:if test="10 &lt; count($followupQandasets)">
-        <xsl:message>
-          <xsl:text>Warning: </xsl:text>
-          <xsl:value-of select="count($followupQandasets)"/>
-          <xsl:text> consecutive followup exercises at slide '</xsl:text>
-          <xsl:apply-templates select="d:title"/>
-          <xsl:text>', id=</xsl:text>
-          <xsl:value-of select="@xml:id"/>
-        </xsl:message>
-      </xsl:if>
+        <xsl:variable name="currentFigureGenerateId" select="generate-id()"/>
+        <xsl:variable name="followupQandasets"
+                      select="following::d:qandaset[generate-id(preceding::d:figure[not(ancestor::d:qandaset)][1]) = $currentFigureGenerateId]"/>
 
-      <xsl:variable name="primarySectionId">
-        <xsl:apply-templates mode="id_or_generate_id" select="."/>
-      </xsl:variable>
+        <xsl:if test="$followupQandasets">
 
-      <section id="{$primarySectionId}_followupExercise">
-        <xsl:choose>
+            <xsl:if test="10 &lt; count($followupQandasets)">
+                <xsl:message>
+                    <xsl:text>Warning: </xsl:text>
+                    <xsl:value-of select="count($followupQandasets)"/>
+                    <xsl:text> consecutive followup exercises at slide '</xsl:text>
+                    <xsl:apply-templates select="d:title"/>
+                    <xsl:text>', id=</xsl:text>
+                    <xsl:value-of select="@xml:id"/>
+                </xsl:message>
+            </xsl:if>
 
-          <xsl:when test="1 = count($followupQandasets)">
-            <xsl:apply-templates select="$followupQandasets" mode="createTitleLink"/>
-          </xsl:when>
+            <xsl:variable name="primarySectionId">
+                <xsl:apply-templates mode="id_or_generate_id" select="."/>
+            </xsl:variable>
 
-          <xsl:otherwise>
-            <ol>
-              <xsl:for-each select="$followupQandasets">
-                <li>
-                  <xsl:apply-templates select="." mode="createTitleLink"/>
-                </li>
-              </xsl:for-each>
-            </ol>
-          </xsl:otherwise>
+            <section id="{$primarySectionId}_followupExercise">
+                <xsl:choose>
 
-        </xsl:choose>
-      </section>
-    </xsl:if>
-
-  </xsl:template>
-
-  <xsl:template match="d:figure" mode="footer">
-    <xsl:param name="index"/>
-    <xsl:param name="length"/>
-    <div class="hdmfooter">
-      <table>
-        <tr>
-          <td class="tooltip">
-            <a target="_blank">
-              <xsl:attribute name="href">
-                <xsl:call-template name="href.target.uri"/>
-              </xsl:attribute>
-              <img src="common/images/book.svg" width="60"
-                style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"/>
-              <p class="tooltiptext">Lecture notes</p>
-            </a>
-          </td>
-          <td class="tooltip">
-            <a target="_blank"
-              href="__presentation{ancestor::*[contains(@annotations, 'slide')]/@xml:id}.pdf">
-              <img src="common/images/printer.svg" width="60"
-                style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"/>
-              <p class="tooltiptext">Pdf slides</p>
-            </a>
-          </td>
-
-          <td class="tooltip">
-            <a target="_blank" href="#{parent::*/@xml:id}">
-              <img src="common/images/compass.svg" width="60"
-                style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"/>
-            </a>
-
-            <xsl:call-template name="createTooltipBreadcrumbHierarchy">
-
-              <xsl:with-param name="nodes"
-                select="
+                    <xsl:when test="1 = count($followupQandasets)">
+                        <xsl:apply-templates select="$followupQandasets" mode="createTitleLink"/>
+                    </xsl:when>
+
+                    <xsl:otherwise>
+                        <ol>
+                            <xsl:for-each select="$followupQandasets">
+                                <li>
+                                    <xsl:apply-templates select="." mode="createTitleLink"/>
+                                </li>
+                            </xsl:for-each>
+                        </ol>
+                    </xsl:otherwise>
+
+                </xsl:choose>
+            </section>
+        </xsl:if>
+
+    </xsl:template>
+
+    <xsl:template match="d:figure" mode="footer">
+        <xsl:param name="index"/>
+        <xsl:param name="length"/>
+        <div class="hdmfooter">
+            <table>
+                <tr>
+                    <td class="tooltip">
+                        <a target="_blank">
+                            <xsl:attribute name="href">
+                                <xsl:call-template name="href.target.uri"/>
+                            </xsl:attribute>
+                            <img src="common/images/book.svg" width="60"
+                                 style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"/>
+                            <p class="tooltiptext">Lecture notes</p>
+                        </a>
+                    </td>
+                    <td class="tooltip">
+                        <a target="_blank"
+                           href="__presentation{ancestor::*[contains(@annotations, 'slide')]/@xml:id}.pdf">
+                            <img src="common/images/printer.svg" width="60"
+                                 style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"/>
+                            <p class="tooltiptext">Pdf slides</p>
+                        </a>
+                    </td>
+
+                    <td class="tooltip">
+                        <a target="_blank" href="#{parent::*/@xml:id}">
+                            <img src="common/images/compass.svg" width="60"
+                                 style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"/>
+                        </a>
+
+                        <xsl:call-template name="createTooltipBreadcrumbHierarchy">
+
+                            <xsl:with-param name="nodes"
+                                            select="
                   ancestor-or-self::d:section |
                   ancestor-or-self::d:chapter |
                   ancestor-or-self::d:appendix"/>
 
-              <xsl:with-param name="currentPosition" select="1"/>
+                            <xsl:with-param name="currentPosition" select="1"/>
+
+                        </xsl:call-template>
+                    </td>
+                    <td>
+                        <xsl:if test="$index">
+                            <xsl:text> (#</xsl:text>
+                            <xsl:value-of select="$index"/>
+                            <xsl:text> of </xsl:text>
+                            <xsl:value-of select="$length"/>
+                            <xsl:text>)</xsl:text>
+                        </xsl:if>
+                    </td>
+
+                    <xsl:variable name="qandaId" select="@xml:id"/>
+                    <xsl:if test="$topicLookup/map/entry[@id = $qandaId]">
+
+                        <td class="tooltip">
+                            <a target="_blank"
+                               href="https://bb.mi.hdm-stuttgart.de/topic/{$topicLookup/map/entry[@id = $qandaId]/@tid}">
+                                <img src="common/images/comment.svg"
+                                     style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;" width="60"/>
+                            </a>
+                            <p class="tooltiptext">Create comment</p>
+                        </td>
+                    </xsl:if>
+                </tr>
+            </table>
+        </div>
+    </xsl:template>
+
+    <xsl:template match="d:chapter | d:section | d:appendix" mode="footer">
+
+        <div class="hdmfooter">
+            <table>
+                <tr>
+                    <td class="tooltip">
+                        <a target="_blank">
+                            <xsl:attribute name="href">
+                                <xsl:call-template name="href.target.uri"/>
+                            </xsl:attribute>
+                            <img src="common/images/book.svg" width="60"
+                                 style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"/>
+                            <p class="tooltiptext">Lecture notes</p>
+                        </a>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </xsl:template>
+
+    <xsl:template match="d:qandaset" mode="createTitleLink">
+
+        <xsl:variable name="linkTarget">
+            <xsl:call-template name="href.target.uri"/>
+        </xsl:variable>
 
-            </xsl:call-template>
-          </td>
-          <td>
-            <xsl:if test="$index">
-              <xsl:text> (#</xsl:text>
-              <xsl:value-of select="$index"/>
-              <xsl:text> of </xsl:text>
-              <xsl:value-of select="$length"/>
-              <xsl:text>)</xsl:text>
-            </xsl:if>
-          </td>
-
-          <xsl:variable name="qandaId" select="@xml:id"/>
-          <xsl:if test="$topicLookup/map/entry[@id = $qandaId]">
-
-            <td class="tooltip">
-              <a target="_blank"
-                href="https://bb.mi.hdm-stuttgart.de/topic/{$topicLookup/map/entry[@id = $qandaId]/@tid}">
-                <img src="common/images/comment.svg"
-                  style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;" width="60"/>
-              </a>
-              <p class="tooltiptext">Create comment</p>
-            </td>
-          </xsl:if>
-        </tr>
-      </table>
-    </div>
-  </xsl:template>
-
-  <xsl:template match="d:chapter | d:section | d:appendix" mode="footer">
-
-    <div class="hdmfooter">
-      <table>
-        <tr>
-          <td class="tooltip">
-            <a target="_blank">
-              <xsl:attribute name="href">
-                <xsl:call-template name="href.target.uri"/>
-              </xsl:attribute>
-              <img src="common/images/book.svg" width="60"
-                style="border: 0mm; margin-top: 0mm; margin-bottom: 0mm;"/>
-              <p class="tooltiptext">Lecture notes</p>
-            </a>
-          </td>
-        </tr>
-      </table>
-    </div>
-  </xsl:template>
-
-  <xsl:template match="d:qandaset" mode="createTitleLink">
-
-    <xsl:variable name="linkTarget">
-      <xsl:call-template name="href.target.uri"/>
-    </xsl:variable>
-
-    <xsl:choose>
-      <xsl:when test="d:title">
-        <xsl:apply-templates select="d:title/node()" mode="createTitleLink">
-          <xsl:with-param name="linkTarget" select="$linkTarget"/>
-        </xsl:apply-templates>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:apply-templates select="preceding-sibling::d:title[1]/node()" mode="createTitleLink">
-          <xsl:with-param name="linkTarget" select="$linkTarget"/>
-        </xsl:apply-templates>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template match="d:xref | d:link" mode="createTitleLink">
-    <xsl:apply-templates select="."/>
-  </xsl:template>
-
-  <xsl:template match="* | text()" mode="createTitleLink">
-    <xsl:param name="linkTarget"/>
-    <a href="{$linkTarget}" target="_blank">
-      <xsl:apply-templates select="."/>
-    </a>
-  </xsl:template>
-
-  <!-- Get rid of block object names e.g. "Figure 3.1" -->
-  <xsl:template match="d:figure">
-    <xsl:apply-templates/>
-  </xsl:template>
-
-  <!-- Ignore e.g. calloutlist elements inside figure -->
-  <xsl:template match="*[contains(@role, 'slideExclude')]">
-    <xsl:message>
-      <xsl:text>Excluding &lt;</xsl:text>
-      <xsl:value-of select="name(.)"/>
-      <xsl:text>&gt; from slides</xsl:text>
-    </xsl:message>
-  </xsl:template>
-
-  <xsl:template match="d:figure/d:title">
-    <h3>
-      <xsl:apply-templates/>
-    </h3>
-  </xsl:template>
-
-  <!-- Hack: Docbooxsl:tek XSL does not handle @valign in images-->
-  <xsl:template match="d:mediaobject[d:imageobject/d:imagedata[@valign]]">
-    <img>
-      <xsl:attribute name="src">
-        <xsl:for-each select="ancestor::*/@xml:base">
-          <xsl:call-template name="hdm.get.leftmost.of.separator">
-            <xsl:with-param name="path" select="."/>
-            <xsl:with-param name="separator" select="'/'"/>
-          </xsl:call-template>
-          <xsl:text>/</xsl:text>
-        </xsl:for-each>
-        <xsl:value-of select="d:imageobject/d:imagedata/@fileref"/>
-      </xsl:attribute>
-
-      <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:when test="d:title">
+                <xsl:apply-templates select="d:title/node()" mode="createTitleLink">
+                    <xsl:with-param name="linkTarget" select="$linkTarget"/>
+                </xsl:apply-templates>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:apply-templates select="preceding-sibling::d:title[1]/node()" mode="createTitleLink">
+                    <xsl:with-param name="linkTarget" select="$linkTarget"/>
+                </xsl:apply-templates>
+            </xsl:otherwise>
         </xsl:choose>
-      </xsl:attribute>
-    </img>
-
-  </xsl:template>
-
-  <xsl:template match="d:videodata">
-    <video controls="controls" preload="auto" width="50%">
-      <xsl:attribute name="title">
-        <xsl:value-of select="normalize-space(../../../d:title)"/>
-      </xsl:attribute>
-
-      <xsl:variable name="hdm_ImageFilename">
-        <!-- hdm_ prefix: do not mess with docbook! -->
-        <xsl:call-template name="mediaobject.filename">
-          <xsl:with-param name="object" select=".."/>
-        </xsl:call-template>
-      </xsl:variable>
-
-      <source src="{$hdm_ImageFilename}" type="video/webm"/>
-      <source src="{$hdm_ImageFilename}.mp4" type="video/mp4"/>
-      <xsl:text>Your Browser does not support the video tag</xsl:text>
-    </video>
-  </xsl:template>
-
-
-  <xsl:template match="d:programlisting">
-    <pre class="programlisting">
-      
-      <xsl:choose>
-        
-        <xsl:when test="not(@language) or @language = 'none'">
-          <xsl:apply-templates/>
-        </xsl:when>
-            
-        <xsl:otherwise>
-          <code class="language-{@language}">
+    </xsl:template>
+
+    <xsl:template match="d:xref | d:link" mode="createTitleLink">
+        <xsl:apply-templates select="."/>
+    </xsl:template>
+
+    <xsl:template match="* | text()" mode="createTitleLink">
+        <xsl:param name="linkTarget"/>
+        <a href="{$linkTarget}" target="_blank">
+            <xsl:apply-templates select="."/>
+        </a>
+    </xsl:template>
+
+    <!-- Get rid of block object names e.g. "Figure 3.1" -->
+    <xsl:template match="d:figure">
+        <xsl:apply-templates/>
+    </xsl:template>
+
+    <!-- Ignore e.g. calloutlist elements inside figure -->
+    <xsl:template match="*[contains(@role, 'slideExclude')]">
+        <xsl:message>
+            <xsl:text>Excluding &lt;</xsl:text>
+            <xsl:value-of select="name(.)"/>
+            <xsl:text>&gt; from slides</xsl:text>
+        </xsl:message>
+    </xsl:template>
+
+    <xsl:template match="d:figure/d:title">
+        <h3>
             <xsl:apply-templates/>
-          </code>
-        </xsl:otherwise>
-             
-      </xsl:choose>
-      
-    </pre>
-  </xsl:template>
-
-  <xsl:template match="*" mode="slideRootSections">
-    <p>
-      <xsl:text>No template defined for element '</xsl:text>
-      <xsl:value-of select="name(.)"/>
-      <xsl:text>' in mode 'slideRootSections'.</xsl:text>
-    </p>
-  </xsl:template>
-
-  <xsl:template match="*" mode="slideRootHeaders">
-    <xsl:message>
-      <xsl:text>No template matching '</xsl:text>
-      <xsl:value-of select="name(.)"/>
-      <xsl:text>' in mode 'slideRootHeaders'</xsl:text>
-    </xsl:message>
-  </xsl:template>
-
-  <xsl:template match="*" mode="slideUnit">
-    <xsl:message>
-      <xsl:text>No template matching '</xsl:text>
-      <xsl:value-of select="name(.)"/>
-      <xsl:text>' in mode 'slideUnit'</xsl:text>
-    </xsl:message>
-  </xsl:template>
-
-  <xsl:template match="*" mode="footer">
-    <xsl:message>
-      <xsl:text>No template defined for element "</xsl:text>
-      <xsl:value-of select="name(.)"/>
-      <xsl:text>" in mode "footer"</xsl:text>
-    </xsl:message>
-  </xsl:template>
+        </h3>
+    </xsl:template>
+
+    <!-- Hack: Docbooxsl:tek XSL does not handle @valign in images-->
+    <xsl:template match="d:mediaobject[d:imageobject/d:imagedata[@valign]]">
+        <img>
+            <xsl:attribute name="src">
+                <xsl:for-each select="ancestor::*/@xml:base">
+                    <xsl:call-template name="hdm.get.leftmost.of.separator">
+                        <xsl:with-param name="path" select="."/>
+                        <xsl:with-param name="separator" select="'/'"/>
+                    </xsl:call-template>
+                    <xsl:text>/</xsl:text>
+                </xsl:for-each>
+                <xsl:value-of select="d:imageobject/d:imagedata/@fileref"/>
+            </xsl:attribute>
+
+            <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:videodata">
+        <video controls="controls" preload="auto" width="50%">
+            <xsl:attribute name="title">
+                <xsl:value-of select="normalize-space(../../../d:title)"/>
+            </xsl:attribute>
+
+            <xsl:variable name="hdm_ImageFilename">
+                <!-- hdm_ prefix: do not mess with docbook! -->
+                <xsl:call-template name="mediaobject.filename">
+                    <xsl:with-param name="object" select=".."/>
+                </xsl:call-template>
+            </xsl:variable>
+
+            <source src="{$hdm_ImageFilename}" type="video/webm"/>
+            <source src="{$hdm_ImageFilename}.mp4" type="video/mp4"/>
+            <xsl:text>Your Browser does not support the video tag</xsl:text>
+        </video>
+    </xsl:template>
+
+
+    <xsl:template match="d:programlisting">
+        <pre class="programlisting">
+
+            <xsl:choose>
+
+                <xsl:when test="not(@language) or @language = 'none'">
+                    <xsl:apply-templates/>
+                </xsl:when>
+
+                <xsl:otherwise>
+                    <code class="language-{@language}">
+                        <xsl:apply-templates/>
+                    </code>
+                </xsl:otherwise>
+
+            </xsl:choose>
+
+        </pre>
+    </xsl:template>
+
+    <xsl:template match="*" mode="slideRootSections">
+        <p>
+            <xsl:text>No template defined for element '</xsl:text>
+            <xsl:value-of select="name(.)"/>
+            <xsl:text>' in mode 'slideRootSections'.</xsl:text>
+        </p>
+    </xsl:template>
+
+    <xsl:template match="*" mode="slideRootHeaders">
+        <xsl:message>
+            <xsl:text>No template matching '</xsl:text>
+            <xsl:value-of select="name(.)"/>
+            <xsl:text>' in mode 'slideRootHeaders'</xsl:text>
+        </xsl:message>
+    </xsl:template>
+
+    <xsl:template match="*" mode="slideUnit">
+        <xsl:message>
+            <xsl:text>No template matching '</xsl:text>
+            <xsl:value-of select="name(.)"/>
+            <xsl:text>' in mode 'slideUnit'</xsl:text>
+        </xsl:message>
+    </xsl:template>
+
+    <xsl:template match="*" mode="footer">
+        <xsl:message>
+            <xsl:text>No template defined for element "</xsl:text>
+            <xsl:value-of select="name(.)"/>
+            <xsl:text>" in mode "footer"</xsl:text>
+        </xsl:message>
+    </xsl:template>
 
 </xsl:stylesheet>
diff --git a/ws/Docbook/Preprocess/make.rules b/ws/Docbook/Preprocess/make.rules
index 56ecef1cb..b6cbc041e 100644
--- a/ws/Docbook/Preprocess/make.rules
+++ b/ws/Docbook/Preprocess/make.rules
@@ -147,7 +147,7 @@ SAXONCMD=java -cp "${DBOOK_XSL}/tools/lib/saxon9he.jar:/usr/share/java/xercesImp
 %.slide: %.slide.xml
 	${SAXON6CMD} $< ${DBOOK_XSL_CUSTOM}/slide/xsl/slideHdm.xsl ${dbookXslSlideParam}
 	rsync -a --exclude .git /usr/share/reveal.js .
-	#cd reveal.js; patch -p1 < ${DBOOK_XSL_CUSTOM}/slide/patch/reveal.css.patch
+	cd reveal.js; patch -p1 < ${DBOOK_XSL_CUSTOM}/slide/patch/reveal.css.patch
 	rsync -a ${DBOOK_XSL_CUSTOM}/slide/slideAssets .
 	touch $*.slide
 
-- 
GitLab