Xml 空白xslt转换
我正在转换以下xml,但它是空的 我希望将testcase添加到主体中并使其成为h1。我很困惑Xml 空白xslt转换,xml,xslt,Xml,Xslt,我正在转换以下xml,但它是空的 我希望将testcase添加到主体中并使其成为h1。我很困惑 <?xml version="1.0" encoding="UTF-8"?> <testsuite errors="1" failures="0" name="TestDemo-20150928232552" tests="1" time="11.405"> <properties/> <system-out> <![CDATA[]
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="1" failures="0" name="TestDemo-20150928232552" tests="1" time="11.405">
<properties/>
<system-out>
<![CDATA[]]> </system-out>
<system-err>
<![CDATA[]]> </system-err>
<testcase classname="TestDemo" name="test_contactForm" time="11.405">
<error message="Message: Unable to find element with xpath '//select[@name='tosh']/option[@value='26 - 50']'
Screenshot: available via screen
" type="NoSuchElementException">
<![CDATA[Traceback (most recent call last):
NoSuchElementException: Message: Unable to find element with xpath '//select[@name='tosh']/option[@value='26 - 50']'
]]> </error>
</testcase>
</testsuite>
请帮忙。任何提示或建议都将不胜感激
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<head>
<title>
<xsl:value-of select="testcase"/>
</title>
</head>
<body>
<xsl:apply-templates select="body"/>
</body>
</html>
</xsl:template>
<xsl:template match="testcase">
<h1><xsl:value-of select="."/></h1>
</xsl:template>
<xsl:template match="error">
<p><xsl:apply-templates/></p>
</xsl:template>
</xsl:stylesheet>
此部分:
<title>
<xsl:value-of select="testcase"/>
</title>
<xsl:apply-templates select="body"/>
如果您希望标题
包含测试用例
的所有文本内容(不知何故,我怀疑您是否真的想要)
本部分:
<title>
<xsl:value-of select="testcase"/>
</title>
<xsl:apply-templates select="body"/>
这个模板没有任何作用,因为它从未应用过:
<xsl:template match="error">
<p><xsl:apply-templates/></p>
</xsl:template>
谢谢您的解释。