我有一個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