我是全世界在 xslt 中编写代码的新手。我希望 xsl 代码查看我的 xml 文件中的每个节点/属性并搜索“__(string)”并计算“result=success/failed”。我在这个站点上找到了一个线程来帮助我一点:
你如何使用 XSLT 进行通配符匹配?
我得到了我的 xsl 代码来查找字符串匹配。但是我的问题是,我不知道如何编写代码来计算给定字符串匹配的成功和失败?我希望输出看起来像这样:
**(Casename)** | **(total success)** | **(total failed)**
__(stringmatch1)| 2 | 0
__(stringmatch2)| 0 | 2
这是 xml 文件的示例:
<report>
<programtest user="testuser">
<programtest software="test">
<programtest testname="SW log">
</programtest>
<programtest testname="HW log">
</programtest>
<programtest testname="loop_program_test">
<programtest casename="test" iteration="1" result="success">
<programtest casename="__temp1" type="specifictestcase" result="success" >
</programtest>
<programtest casename="__temp2" type="specifictestcase" result="failed" >
</programtest>
</programtest>
<programtest casename="test" iteration="2" result="success">
<programtest casename="__temp1" type="specifictestcase" result="success" >
</programtest>
<programtest casename="__temp2" type="specifictestcase" result="failed" >
</programtest>
</programtest>
</programtest>
</programtest>
</programtest>
</report>
任何帮助表示赞赏!:-)