aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-03-01 13:24:47 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-03-01 13:24:47 +0000
commit458820df6cb976e0642c67ca775d8e7095c091f2 (patch)
tree59fa2b321036f34e99ec8308be32cac26f596b3e
parent6b8bb8d74ab500eb6dddecbdf578c9cdf14a748c (diff)
* Generate valid HTML.
-rw-r--r--src/nix-log2xml/log2html.xsl37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/nix-log2xml/log2html.xsl b/src/nix-log2xml/log2html.xsl
index 0718df230..209399470 100644
--- a/src/nix-log2xml/log2html.xsl
+++ b/src/nix-log2xml/log2html.xsl
@@ -2,7 +2,9 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method='html' />
+ <xsl:output method='html' encoding="UTF-8"
+ doctype-public="-//W3C//DTD HTML 4.01//EN"
+ doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
<xsl:template match="logfile">
<html>
@@ -37,22 +39,27 @@
<script type='text/javascript'>showTreeToggle(<xsl:value-of select="$collapsed"/>)</script>
<xsl:apply-templates select='head'/>
-
- <ul class='nesting' style="{$style}">
- <xsl:for-each select='line|nest'>
- <!-- Is this the last line? If so, mark it as such so that it
- can be rendered differently. -->
- <xsl:variable name="class"><xsl:choose><xsl:when test="position() != last()">line</xsl:when><xsl:otherwise>lastline</xsl:otherwise></xsl:choose></xsl:variable>
+ <!-- Be careful to only generate <ul>s if there are <li>s, otherwise it’s malformed. -->
+ <xsl:if test="line|nest">
+
+ <ul class='nesting' style="{$style}">
+ <xsl:for-each select='line|nest'>
+
+ <!-- Is this the last line? If so, mark it as such so that it
+ can be rendered differently. -->
+ <xsl:variable name="class"><xsl:choose><xsl:when test="position() != last()">line</xsl:when><xsl:otherwise>lastline</xsl:otherwise></xsl:choose></xsl:variable>
- <li class='{$class}'>
- <span class='lineconn' />
- <span class='linebody'>
- <xsl:apply-templates select='.'/>
- </span>
- </li>
- </xsl:for-each>
- </ul>
+ <li class='{$class}'>
+ <span class='lineconn' />
+ <span class='linebody'>
+ <xsl:apply-templates select='.'/>
+ </span>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
+
</xsl:template>