<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="//unittest-results"/>
</xsl:template>
<xsl:template match="unittest-results">
<html>
<body>
<h3>
UnitTest++測試了<xsl:value-of select="@tests"/>筆資料,<xsl:value-of select="@failedtests"/>筆失敗,費時<xsl:value-of select="@time"/>秒
</h3>
<table>
<tr>
<th>Suite</th>
<th>測試</th>
<th>費時</th>
<th>訊息</th>
</tr>
<xsl:for-each select="test">
<xsl:if test="count(failure)>0">
<tr bgcolor="#ffaaaa">
<td>
<xsl:value-of select="@suite"/>
</td>
<td>
<font color="green">
<xsl:value-of select="@name"/>
</font>
</td>
<td>
<xsl:value-of select="@time"/>
</td>
<td>
<xsl:value-of select="failure/@message"/>
</td>
</tr>
</xsl:if>
<xsl:if test="count(failure)=0">
<tr>
<td>
<xsl:value-of select="@suite"/>
</td>
<td>
<font color="green">
<xsl:value-of select="@name"/>
</font>
</td>
<td>
<xsl:value-of select="@time"/>
</td>
<td></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>