我想进行XSL转换以提取测试结果。
输入xml:
<?xml version="1.0" encoding="UTF-8"?>
<cruisecontrol project="Build">
<build date="2018-11-27 07:24:32" buildtime="00:03:00" buildcondition="ForceBuild">
<TestRun xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" id="b32dd48f-b2cb-41a9-a452-20eb979a50ea" name="bs_p@p_BS 2018-11-27 07:27:33">
<ResultSummary outcome="Completed">
<Counters total="49" executed="49" passed="49" failed="0" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
</ResultSummary>
</TestRun>
</build>
</cruisecontrol>
XSL转换:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
Tests run: <a href="#all"><b><xsl:value-of select="//Counters/@total"/></b></a>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
不幸的是,由于TestRun节点的名称空间
xmlns =“ http://microsoft.com/schemas/VisualStudio/TeamTest/2010”
我无法选择“计数器”节点的属性值。如果删除此命名空间,则一切正常-但我可以更改输入文件的结构。
如何修改此转换器以从“计数器”节点的属性中提取值