您的位置:首页 > 编程语言 > C语言/C++

Google C++ Testing Framework的结果显示样式表

2009-07-28 17:16 513 查看
XSL 指扩展样式表语言(EXtensible Stylesheet Language)。

CSS = HTML 样式表, 向 HTML 元素添加样式是很容易的。通过 CSS,很容易告知浏览器用特定的字体或颜色显示一个元素。

XSL = XML 样式表, XSL 可描述如何来显示 XML 文档(使用 XSLT 将 XML 转换为 XHTML).

[XSLT 教程]http://www.w3school.com.cn/xsl/index.asp

<?xml version="1.0" encoding='shift_jis' standalone='yes' ?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xml:lang="ja">

<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>Test Report</TITLE>
<STYLE>
TABLE { color:#222222; font-size:10pt; font-family:'俵俽 僑僔僢僋' 'sanserif'; }
TH { font-weight:normal; color:#FFFFFF; background-color:#888888; }
TR.check { background-color:#EEEEEE }
TD.check { background-color:#EEEEEE }
H1 { color:#111111; font-family:'Times New Roman' '俵俽 俹柧挬' 'serif'; border-style:solid; border-width:0px; border-bottom-width:3px; border-bottom-color:#444488; }
H2 { color:#222222; font-family:'Times New Roman' '俵俽 俹柧挬' 'serif'; border-style:solid; border-width:0px; border-bottom-width:2px; border-bottom-color:#444488; }
H3 { color:#333333; font-family:'Times New Roman' '俵俽 俹柧挬' 'serif'; border-style:solid; border-width:0px; border-bottom-width:1px; border-bottom-color:#444488; margin-bottom:8px; }
H4 { color:#444444; font-family:'Times New Roman' '俵俽 俹柧挬' 'serif'; border-style:solid; border-width:0px; border-bottom-width:1px; border-bottom-color:#CCCCDD; margin-bottom:8px; }
H5 { color:#555555; font-family:'Times New Roman' '俵俽 俹柧挬' 'serif'; border-style:solid; border-width:0px; border-bottom-width:1px; border-bottom-color:#EEEEFF; margin-bottom:8px; }
H6 { color:#666666; font-family:'Times New Roman' '俵俽 俹柧挬' 'serif'; border-style:solid; border-width:0px; border-bottom-width:1px; border-bottom-color:#F8F8FF; margin-bottom:8px; }

SPAN.good { color:#006666; font-weight:bold; }
SPAN.critical { color:#880000; font-weight:bold; }}
</STYLE>
</HEAD>
<BODY>
<H1>Unit Test Report</H1>
<xsl:apply-templates />
</BODY>
</HTML>
</xsl:template>

<xsl:template match="testsuite">
<xsl:variable name= "testsuiteName" select= "@name">
</xsl:variable>
<xsl:if test="string($testsuiteName) = "AllTests"">
<H2>Statistics</H2>
<TABLE>
<TR>
<TH>Status</TH>
<TH>Number</TH>
</TR>
<TR>
<TD>TotalCase</TD>
<TD align="right"><xsl:value-of select="@tests"/></TD>
</TR>
<TR>
<TD>Disabled</TD>
<TD align="right" bgcolor="#ff00ff"><xsl:value-of select="@disabled"/></TD>
</TR>
<TR>
<TD>Errors</TD>
<TD align="right" bgcolor="#ff00ff"><xsl:value-of select="@errors"/></TD>
</TR>

<TR>
<TD>Failures</TD>
<TD align="right" bgcolor="#ff00ff"><xsl:value-of select="@failures"/></TD>
</TR>

</TABLE>
</xsl:if>

<xsl:for-each select="./testsuite">
<H2>TestsuiteName: <xsl:value-of select="@name"/></H2>
<TABLE>
<TR>
<TH>Name</TH>
<TH>Status</TH>
<TH>Message</TH>
</TR>
<xsl:apply-templates select="testcase"/>
</TABLE>
</xsl:for-each>
</xsl:template>

<xsl:template match="testcase">
<TR>
<TD align="right"><xsl:value-of select="@name"/></TD>
<TD><xsl:value-of select="@status"/></TD>
<xsl:choose>
<xsl:when test="failure">
<TD bgcolor="#ff00ff"><xsl:apply-templates select="failure"/></TD>
</xsl:when>
<xsl:otherwise>
<TD></TD>
</xsl:otherwise>
</xsl:choose>
</TR>
</xsl:template>

<xsl:template match="failure">
<xsl:value-of select="@message"/>
</xsl:template>

</xsl:stylesheet>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: