Commit 14211506 authored by Dr. Martin Goik's avatar Dr. Martin Goik

Embedded SVG data in ILIAS pages

parent fbefc2f6
......@@ -7,12 +7,21 @@
#-s:$1 \
# -xsl:/usr/share/hdm-docbook-xsl/CustomLayer/Klausur/docbook2klausur.xsl
destdir=/tmp/__gensvg_$$
svgGenerateScript=$destdir/__create__.sh
mkdir -p $destdir
java -cp "/usr/share/hdm-docbook-xsl/lib/xslthl-2.1.3.jar:/usr/share/hdm-docbook-xsl/docbook-xsl-1.79.2/tools/lib/saxon.jar:/usr/share/java/xercesImpl.jar" -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration com.icl.saxon.StyleSheet klausur.xml /usr/share/hdm-docbook-xsl/CustomLayer/Klausur/docbook2svgembedd.xsl tmpDestDir=$destdir > $svgGenerateScript
sh $svgGenerateScript
java -cp "/usr/share/hdm-docbook-xsl/lib/xslthl-2.1.3.jar:/usr/share/hdm-docbook-xsl/docbook-xsl-1.79.2/tools/lib/saxon.jar:/usr/share/java/xercesImpl.jar" \
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl \
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration \
com.icl.saxon.StyleSheet \
$1 \
/usr/share/hdm-docbook-xsl/CustomLayer/Klausur/docbook2klausur.xsl
/usr/share/hdm-docbook-xsl/CustomLayer/Klausur/docbook2klausur.xsl tmpDestDir=$destdir
rm -rf $destdir
#end
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:db="http://docbook.org/ns/docbook"
exclude-result-prefixes="xlink db svg html"
version="2.0">
<xsl:param name="tmpDestDir"/>
<xsl:template name="getBase64Filename">
<xsl:param name="svgFilename"/>
<xsl:value-of select="$tmpDestDir"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="$svgFilename"/>
<xsl:text>.base64</xsl:text>
</xsl:template>
</xsl:stylesheet>
......@@ -9,18 +9,13 @@
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:db="http://docbook.org/ns/docbook"
xmlns:s6hl="java:net.sf.xslthl.ConnectorSaxon6"
xmlns:xslthl="http://xslthl.sf.net"
extension-element-prefixes="s6hl xslthl"
exclude-result-prefixes="xs xlink xila xi trans db svg html m"
version="2.0">
<!--
xmlns:fn = "http://www.w3.org/2005/xpath-functions"
-->
<xsl:include href="common.xsl"/>
<xsl:template match="/db:book">
<xsl:apply-templates select="db:chapter"/>
......@@ -149,12 +144,15 @@
<xsl:template match="db:td">
<td valign="top">
<xsl:copy-of select="@colspan"/>
<xsl:copy-of select="@rowspan"/>
<xsl:apply-templates/>
</td>
</xsl:template>
<xsl:template match="db:th">
<td valign="top"><!-- Sigh! ILIAS HTML handling is soooo stupid! -->
<td style="text-align: center; font-weight: bolder;" valign="top">
<xsl:copy-of select="@colspan"/>
<xsl:copy-of select="@rowspan"/>
<xsl:apply-templates/>
</td>
</xsl:template>
......@@ -230,6 +228,17 @@
</span>
</xsl:template>
<xsl:template match="db:mediaobject[db:imageobject[db:imagedata]]">
<xsl:variable name="base64Filename">
<xsl:call-template name="getBase64Filename">
<xsl:with-param name="svgFilename" select="db:imageobject/db:imagedata/@fileref"/>
</xsl:call-template>
</xsl:variable>
<img src="data:image/svg+xml;base64,{document($base64Filename)/data/text()}"/>
</xsl:template>
<!-- link mode -->
......
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:db="http://docbook.org/ns/docbook"
exclude-result-prefixes="xlink db svg html"
version="2.0">
<xsl:include href="common.xsl"/>
<xsl:variable name="n">
<xsl:text>
</xsl:text>
</xsl:variable>
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:text>#!/bin/bash</xsl:text>
<xsl:value-of select="$n"/>
<xsl:value-of select="$n"/>
<xsl:apply-templates select="//db:imagedata"/>
</xsl:template>
<xsl:template match="db:imagedata">
<xsl:variable name="base64GeneratedFilename">
<xsl:call-template name="getBase64Filename">
<xsl:with-param name="svgFilename" select="@fileref"/>
</xsl:call-template>
</xsl:variable>
<xsl:text>echo -n '&lt;data&gt;' &gt; </xsl:text>
<xsl:value-of select="$base64GeneratedFilename"/>
<xsl:value-of select="$n"/>
<xsl:text>base64 </xsl:text>
<xsl:value-of select="@fileref"/>
<xsl:text> &gt;&gt; </xsl:text>
<xsl:value-of select="$base64GeneratedFilename"/>
<xsl:value-of select="$n"/>
<xsl:text>echo '&lt;/data&gt;' &gt;&gt; </xsl:text>
<xsl:value-of select="$base64GeneratedFilename"/>
<xsl:value-of select="$n"/>
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment