diff --git a/ws/Docbook/CustomLayer/Klausur/docbook2klausur.xsl b/ws/Docbook/CustomLayer/Klausur/docbook2klausur.xsl new file mode 100644 index 0000000000000000000000000000000000000000..494b63c648f86b47511dcc362f7592b527682663 --- /dev/null +++ b/ws/Docbook/CustomLayer/Klausur/docbook2klausur.xsl @@ -0,0 +1,217 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xila="http://www.w3.org/2001/XInclude/local-attributes" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:trans="http://docbook.org/ns/transclusion" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:m="http://www.w3.org/1998/Math/MathML" + xmlns:html="http://www.w3.org/1999/xhtml" + xmlns:db="http://docbook.org/ns/docbook" + exclude-result-prefixes="xs" + version="2.0"> + + <xsl:template match="/db:book"> + <xsl:apply-templates select="db:chapter"/> + </xsl:template> + + <xsl:template match="db:chapter"> + <xsl:result-document href="{@xml:id}.html" method="html" indent="no"> + <html> + <body > + <xsl:apply-templates/> + </body> + </html> + </xsl:result-document> + </xsl:template> + + <xsl:template match="db:title"> + <h1> + <xsl:apply-templates/> + </h1> + </xsl:template> + + + <!-- Title in ILIAS --> + <xsl:template match="db:chapter/db:title"/> + + <!-- Sectioning --> + <xsl:template match="db:section"> + <xsl:apply-templates/> + </xsl:template> + + + <!-- Blocks --> + <xsl:template match="db:para"> + <p> + <xsl:apply-templates select="*|text()" mode="link"/> + </p> + </xsl:template> + + <xsl:template match="db:programlisting"> + <pre style="display:table; font-size:90%; font-family: 'Lucida Console', Monaco, monospace; background-color: #EEF5FA;"> + <xsl:apply-templates mode="link"/> + </pre> + </xsl:template> + + <!-- Lists --> + + <xsl:template match="db:itemizedlist"> + <ul> + <xsl:apply-templates/> + </ul> + </xsl:template> + + <xsl:template match="db:orderedlist"> + <ol> + <xsl:apply-templates/> + </ol> + </xsl:template> + + <xsl:template match="db:listitem"> + <li> + <xsl:apply-templates/> + </li> + </xsl:template> + + <!-- Admonitions --> + + <xsl:template match="db:tip"> + <div style="display:table; background-color: #DEFBDE;"> + <p>Hinweis:</p> + <xsl:apply-templates/> + </div> + </xsl:template> + + <xsl:template match="db:caution"> + <div style="display:table; background-color: #FE4343;"> + <p>Achtung:</p> + <xsl:apply-templates/> + </div> + </xsl:template> + <!-- Inlines --> + + <xsl:template match="db:xref"> + <span style="font-weight: bold;"> + <xsl:apply-templates select="id(@linkend)/db:title" mode="xref"/> + </span> + </xsl:template> + + <xsl:template match="db:link"> + <!-- link already present from template mode='link' --> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="db:emphasis|db:acronym"> + <emph style="font-weight: bold;"> + <xsl:apply-templates/> + </emph> + </xsl:template> + + <xsl:template match="db:quote"> + <xsl:text>»</xsl:text> + <xsl:apply-templates/> + <xsl:text>«</xsl:text> + </xsl:template> + + <xsl:template match="db:productname|db:foreignphrase"> + <emph> + <xsl:apply-templates/> + </emph> + </xsl:template> + + + <xsl:template match="db:code"> + <code style='font-size:90%; font-family: "Lucida Console", Monaco, monospace; background-color: #EEF5FA;'> + <xsl:apply-templates/> + </code> + </xsl:template> + + <xsl:template match="db:filename"> + <span style="color: #810000;"> + <xsl:apply-templates/> + </span> + </xsl:template> + + <xsl:template match="db:package"> + <span style="font-size:90%; font-family: 'Lucida Console', Monaco, monospace; color: #FB6019;"> + <xsl:apply-templates/> + </span> + </xsl:template> + + <xsl:template match="db:classname"> + <span style="font-size:90%; font-family: 'Lucida Console', Monaco, monospace;color: #FB9C19;"> + <xsl:apply-templates/> + </span> + </xsl:template> + + <xsl:template match="db:interfacename"> + <span style="font-size:90%; font-family: 'Lucida Console', Monaco, monospace;color: #B9B505;"> + <xsl:apply-templates/> + </span> + </xsl:template> + + <xsl:template match="db:methodname"> + <span style="font-size:90%; font-family: 'Lucida Console', Monaco, monospace;color: #C29B07;"> + <xsl:apply-templates/> + </span> + </xsl:template> + + + <!-- link mode --> + + <xsl:template mode="link" match="db:package|db:classname|db:interfacename|db:methodname|db:link|db:emphasis|db:code|db:filename|db:foreignphrase|db:productname"> + <xsl:choose> + <xsl:when test="@xlink:href"> + <a href="{@xlink:href}" target="_blank"> + <xsl:apply-templates select="."/> + </a> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="."/> + </xsl:otherwise> + </xsl:choose> + + </xsl:template> + + <!-- Hack defeating the infamous ILIAS HTML input facility --> + <xsl:template match="db:para/text()[0 = string-length(normalize-space(.))]" mode="link"> + <span> + <xsl:text> </xsl:text> + </span> + </xsl:template> + + + <!-- Ignoring most block elements with respect to linking --> + <xsl:template match="*" mode="link"> + <xsl:apply-templates select="."/> + </xsl:template> + + <!-- xref mode --> + <xsl:template mode="xref" match="db:title"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="*" mode="xref"> + <p style="background-color: red;"> + <xsl:text>No template defined for element '</xsl:text> + <xsl:value-of select="name(.)"/> + <xsl:text>' in mode 'xref'</xsl:text> + </p> + </xsl:template> + + <!-- The last resort --> + + <xsl:template match="*"> + <p style="background-color: red;"> + <xsl:text>No template defined for element '</xsl:text> + <xsl:value-of select="name(.)"/> + <xsl:text>'</xsl:text> + </p> + </xsl:template> + + + +</xsl:stylesheet> \ No newline at end of file