grim/gplate

Added number formatting

2008-02-10, grim
9c7806da0c37
Parents e9b4a69b5777
Children ced54c8be295
Added number formatting
Made the arch and version parameters options
Commented blocks
--- a/tests/check.xsl Sun Feb 10 08:47:12 2008 -0600
+++ b/tests/check.xsl Sun Feb 10 09:46:11 2008 -0600
@@ -4,9 +4,12 @@
xmlns:check="http://check.sourceforge.net/ns"
>
+ <!-- default parameters -->
<xsl:param name="project"/>
+ <xsl:param name="version"/>
<xsl:param name="arch"/>
+ <!-- output options -->
<xsl:output method="xml"
version="1.0"
encoding="UTF-8"
@@ -14,6 +17,12 @@
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
/>
+ <!-- number of tests, number of passes, passed percentage -->
+ <xsl:variable name="tests" select="count(/check:testsuites/check:suite/check:test)"/>
+ <xsl:variable name="passes" select="count(/check:testsuites/check:suite/check:test[@result='success'])"/>
+ <xsl:variable name="percent" select="($passes div $tests)"/>
+
+ <!-- java scriptz! -->
<xsl:variable name="script">
<xsl:comment>
function toggle(div) {
@@ -48,6 +57,7 @@
</xsl:comment>
</xsl:variable>
+ <!-- css -->
<xsl:variable name="css">
<xsl:comment>
pre { margin: 0px; }
@@ -60,6 +70,7 @@
</xsl:comment>
</xsl:variable>
+ <!-- title -->
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="$project">
@@ -72,6 +83,31 @@
<xsl:text> - Check Results</xsl:text>
</xsl:variable>
+ <!-- architect -->
+ <xsl:variable name="architect">
+ <xsl:choose>
+ <xsl:when test="$arch">
+ <xsl:value-of select="$arch"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Unknown</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- version -->
+ <xsl:variable name="project_version">
+ <xsl:choose>
+ <xsl:when test="$version">
+ <xsl:value-of select="$version"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>Unknown</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!-- meat and ... here, where the fuck are my potatoes!?!?! -->
<xsl:template match="check:testsuites">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
@@ -90,11 +126,11 @@
<table>
<tr>
<td><strong><xsl:text>Version:</xsl:text></strong></td>
- <td><xsl:value-of select="$version"/></td>
+ <td><xsl:copy-of select="$project_version"/></td>
</tr>
<tr>
<td><strong><xsl:text>Architect:</xsl:text></strong></td>
- <td><xsl:value-of select="$arch"/></td>
+ <td><xsl:copy-of select="$architect"/></td>
</tr>
<tr>
<td><strong><xsl:text>Ran on:</xsl:text></strong></td>
@@ -102,7 +138,18 @@
</tr>
<tr>
<td><strong><xsl:text>Duration:</xsl:text></strong></td>
- <td><xsl:value-of select="check:duration"/><xsl:text> seconds</xsl:text></td>
+ <td><xsl:value-of select="format-number(check:duration, '###.##')"/><xsl:text> seconds</xsl:text></td>
+ </tr>
+ <tr>
+ <td><strong>Results:</strong></td>
+ <td>
+ <xsl:copy-of select="$passes"/>
+ <xsl:text> of </xsl:text>
+ <xsl:copy-of select="$tests"/>
+ <xsl:text> (</xsl:text>
+ <xsl:value-of select="format-number($percent, '###.##%')"/>
+ <xsl:text>) tests passed</xsl:text>
+ </td>
</tr>
</table>
<p>