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

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) = &quot;AllTests&quot;">
 <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>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值