У меня есть файл данных в формате xml, он содержит информацию о тестах, я хочу получить хороший вид в браузере, я хочу точно указать эту информацию в разных таблицах, всю таблицу информации о тесте, таблицу информации о тесте каждого модуля и таблицу случаев неудачного теста. .
<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:apply-templates select="testsuites"/> <xsl:apply-templates select="testsuite"/> <xsl:apply-templates select="testcase"/> <xsl:apply-templates select="failure"/>
он показывает только первый формат шаблонов. Я не знаю, почему он показывает только первую таблицу о всех тестах выше. хочешь посмотреть, что я пробовал? но я не знаю, как показать вам? - person gladman   schedule 02.07.2013