Skip to content

Instantly share code, notes, and snippets.

Created Apr 30, 2019
What would you like to do?
XSL for Creating an Appendix with wkhtmltopdf
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
indent="yes" />
<xsl:template match="outline:outline">
<title>Appendix A</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
h1 {
text-align: center;
font-size: 20px;
font-family: arial;
div {border-bottom: 1px dashed rgb(200,200,200);}
span {float: right;}
li {list-style: none;}
ul {
font-size: 20px;
font-family: arial;
ul ul {font-size: 80%; }
ul {padding-left: 0em;}
ul ul {padding-left: 1em;}
a {text-decoration:none; color: #287eab;}
<h1>Appendix A</h1>
<ul><xsl:apply-templates select="outline:item/outline:item"/></ul>
<xsl:template name="paramname">
<xsl:param name="str" />
<xsl:when test="contains($str,':')">
<xsl:value-of select="substring-after($str,':')" />
<xsl:value-of select="$str" />
<xsl:template match="outline:item/outline:item">
<xsl:if test="@title!=''">
<xsl:if test="@link">
<xsl:attribute name="href"><xsl:value-of select="@link"/></xsl:attribute>
<xsl:call-template name="paramname">
<xsl:with-param name="str" select="normalize-space(@title)" />
<span> <xsl:value-of select="@page" /> </span>
<xsl:comment>added to prevent self-closing tags in QtXmlPatterns</xsl:comment>
<xsl:apply-templates select="outline:item"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment