我有一个xml格式的数据文件,它包含了关于测试的信息,我想在浏览器中获得一个好看的视图,我想要在不同的表格中精确的看到这些信息,所有测试信息表,每个模块测试信息表和测试失败案例表。XSLT格式一个xml数据文件以多种表格显示使用HTML格式
<testsuites tests="111" failures="3" disabled="0" errors="0" time="60.947" name="AllTests">
<testsuite name="ChdrvTestAout" tests="4" failures="0" disabled="0" errors="0" time="0">
</testsuite>
<testsuite name="ChdrvTestTuner" tests="28" failures="3" disabled="0" errors="0" time="60.944">
<testcase name="Case0001" status="run" time="0.001" classname="ChdrvTestTuner" />
<testcase name="Case0007" status="run" time="27.271" classname="ChdrvTestTuner">
<failure message="Value of: CHDRV_TEST_TUNER_0007()
 Actual: 0
Expected: (1)
Which is: 1" type=""><![CDATA[src/chdrv_tuner_test.cc:71
Value of: CHDRV_TEST_TUNER_0007()
Actual: 0
Expected: (1)
Which is: 1]]></failure>
</testcase>
</testsuite>
<testsuite name="FactorialTest" tests="3" failures="0" disabled="0" errors="0" time="0">
</testsuite>
<testsuite name="IsPrimeTest" tests="3" failures="0" disabled="0" errors="0" time="0">
</testsuite>
</testsuites>
我想使用XSLT格式的HTML,以显示多个表中的数据,我想表明在单独的模块表这个数据,如格式:
-------------------------------------
module name | tests | failures
---------------------------------------
alltests | 111 | 3
--------------------------------------
-------------------------------------
module name | tests | failures
---------------------------------------
ChdrvTestAout| 4 | 0
--------------------------------------
-------------------------------------
module name | tests | failures
---------------------------------------
ChdrvTestTuner| 28 | 3
--------------------------------------
----------------------------------------------------------------------
casename | module | failed message
----------------------------------------------------------------------
case0007 | ChdrvTestTuner | src/chdrv_tuner_test.cc:71
----------------------------------------------------------------------
请参阅我曾尝试这里http://www.pastebin.ca/2414163, 但它只显示上面第一个“alltest”表? 如何编写XSLT来做到这一点?非常感谢您的帮助
这里是XSLT的 “/” 模板:
<xsl:template match="/">
<html>
<body>
<h2 align="center">ChangHong driver test report!!!</h2>
<xsl:apply-templates select="testsuites"/>
<xsl:apply-templates select="testsuite"/>
<xsl:apply-templates select="testcase"/>
<xsl:apply-templates select="failure"/>
</body>
</html>
</xsl:template>
非常感谢!
我试图使用一些的xsl:模板等, '的 的 的 '它只显示第一个模板格式。我不知道为什么它只显示上面关于“alltest”的第一个表格。 你想看看我试过了吗?但我不知道如何展示你? –
gladman
@LarsH请看我试过的东西,http://www.pastebin.ca/2414163 – gladman