--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<!--\r
+#\r
+# Copyright (C) 2006 Daniel Berrange\r
+#\r
+# This program is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU General Public License as published by\r
+# the Free Software Foundation; either version 2 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU General Public License\r
+# along with this program; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+-->\r
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+ version="1.0">\r
+\r
+ <xsl:output method="html"/>\r
+\r
+ <xsl:template match="coverage">\r
+ <html>\r
+ <head>\r
+ <title>Coverage report</title>\r
+ <style type="text/css">\r
+ tbody tr.odd td.label {\r
+ border-top: 1px solid rgb(128,128,128);\r
+ border-bottom: 1px solid rgb(128,128,128);\r
+ }\r
+ tbody tr.odd td.label {\r
+ background: rgb(200,200,200);\r
+ }\r
+ \r
+ thead, tfoot {\r
+ background: rgb(60,60,60);\r
+ color: white;\r
+ font-weight: bold;\r
+ }\r
+\r
+ tr td.perfect {\r
+ background: rgb(0,255,0);\r
+ color: black;\r
+ }\r
+ tr td.excellant {\r
+ background: rgb(140,255,140);\r
+ color: black;\r
+ }\r
+ tr td.good {\r
+ background: rgb(160,255,0);\r
+ color: black;\r
+ }\r
+ tr td.poor {\r
+ background: rgb(255,160,0);\r
+ color: black;\r
+ }\r
+ tr td.bad {\r
+ background: rgb(255,140,140);\r
+ color: black;\r
+ }\r
+ tr td.terrible {\r
+ background: rgb(255,0,0);\r
+ color: black;\r
+ }\r
+ </style>\r
+ </head>\r
+ <body>\r
+ <h1>Coverage report</h1>\r
+ <xsl:apply-templates/>\r
+ </body>\r
+ </html>\r
+ </xsl:template>\r
+\r
+ <xsl:template match="functions">\r
+ <h2>Function coverage</h2>\r
+ <xsl:call-template name="content">\r
+ <xsl:with-param name="type" select="'function'"/>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+ \r
+\r
+ <xsl:template match="files">\r
+ <h2>File coverage</h2>\r
+ <xsl:call-template name="content">\r
+ <xsl:with-param name="type" select="'file'"/>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <xsl:template name="content">\r
+ <xsl:param name="type"/>\r
+ <table>\r
+ <thead>\r
+ <tr>\r
+ <th>Name</th>\r
+ <th>Lines</th>\r
+ <th>Branches</th>\r
+ <th>Conditions</th>\r
+ <th>Calls</th>\r
+ </tr>\r
+ </thead>\r
+ <tbody>\r
+ <xsl:for-each select="entry">\r
+ <xsl:call-template name="entry">\r
+ <xsl:with-param name="type" select="$type"/>\r
+ <xsl:with-param name="class">\r
+ <xsl:choose>\r
+ <xsl:when test="position() mod 2">\r
+ <xsl:text>odd</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>even</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:for-each>\r
+ </tbody>\r
+ <tfoot>\r
+ <xsl:for-each select="summary">\r
+ <xsl:call-template name="entry">\r
+ <xsl:with-param name="type" select="'summary'"/>\r
+ <xsl:with-param name="class">\r
+ <xsl:choose>\r
+ <xsl:when test="position() mod 2">\r
+ <xsl:text>odd</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>even</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:for-each>\r
+ </tfoot>\r
+ </table>\r
+ </xsl:template>\r
+ \r
+ <xsl:template name="entry">\r
+ <xsl:param name="type"/>\r
+ <xsl:param name="class"/>\r
+ <tr class="{$class}">\r
+ <xsl:choose>\r
+ <xsl:when test="$type = 'function'">\r
+ <td class="label"><a href="{@details}.html#{@name}"><xsl:value-of select="@name"/></a></td>\r
+ </xsl:when>\r
+ <xsl:when test="$type = 'file'">\r
+ <td class="label"><a href="{@details}.html"><xsl:value-of select="@name"/></a></td>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <td class="label">Summary</td>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+\r
+ <xsl:if test="count(lines)">\r
+ <xsl:apply-templates select="lines"/>\r
+ </xsl:if>\r
+ <xsl:if test="not(count(lines))">\r
+ <xsl:call-template name="missing"/>\r
+ </xsl:if>\r
+\r
+ <xsl:if test="count(branches)">\r
+ <xsl:apply-templates select="branches"/>\r
+ </xsl:if>\r
+ <xsl:if test="not(count(branches))">\r
+ <xsl:call-template name="missing"/>\r
+ </xsl:if>\r
+\r
+ <xsl:if test="count(conditions)">\r
+ <xsl:apply-templates select="conditions"/>\r
+ </xsl:if>\r
+ <xsl:if test="not(count(conditions))">\r
+ <xsl:call-template name="missing"/>\r
+ </xsl:if>\r
+\r
+ <xsl:if test="count(calls)">\r
+ <xsl:apply-templates select="calls"/>\r
+ </xsl:if>\r
+ <xsl:if test="not(count(calls))">\r
+ <xsl:call-template name="missing"/>\r
+ </xsl:if>\r
+\r
+ </tr>\r
+ </xsl:template>\r
+ \r
+ <xsl:template match="lines">\r
+ <xsl:call-template name="row"/>\r
+ </xsl:template>\r
+\r
+ <xsl:template match="branches">\r
+ <xsl:call-template name="row"/>\r
+ </xsl:template>\r
+\r
+ <xsl:template match="conditions">\r
+ <xsl:call-template name="row"/>\r
+ </xsl:template>\r
+\r
+ <xsl:template match="calls">\r
+ <xsl:call-template name="row"/>\r
+ </xsl:template>\r
+\r
+ <xsl:template name="missing">\r
+ <td></td>\r
+ </xsl:template>\r
+\r
+ <xsl:template name="row">\r
+ <xsl:variable name="quality">\r
+ <xsl:choose>\r
+ <xsl:when test="@coverage = 100">\r
+ <xsl:text>perfect</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="@coverage >= 80.0">\r
+ <xsl:text>excellant</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="@coverage >= 60.0">\r
+ <xsl:text>good</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="@coverage >= 40.0">\r
+ <xsl:text>poor</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="@coverage >= 20.0">\r
+ <xsl:text>bad</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>terrible</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+ \r
+ <td class="{$quality}"><xsl:value-of select="@coverage"/>% of <xsl:value-of select="@count"/></td>\r
+ </xsl:template>\r
+\r
+</xsl:stylesheet>\r