我可以向XSLT输出添加XML声明吗?
发布时间:2020-12-16 23:01:38 所属栏目:百科 来源:网络整理
导读:这是我当前的 XML输出: EmployeeImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Employee EmployeeNumber123/EmployeeNumber FirstNameJose/FirstName /Employee /EmployeeImport 等等.我希望得到的输出如下: ?xml version="1.0" encoding
这是我当前的
XML输出:
<EmployeeImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Employee> <EmployeeNumber>123</EmployeeNumber> <FirstName>Jose</FirstName> </Employee> </EmployeeImport> 等等.我希望得到的输出如下: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <EmployeeImport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Employee> <EmployeeNumber>123</EmployeeNumber> <FirstName>Jose</FirstName> </Employee> </EmployeeImport> 我希望能够将第一行添加到我的输出中.在我的XSLT中,我试过& lt; 打印“<”但它被解释为& lt;.我也尝试了< xsl:text>,但遇到了同样的问题.有没有办法将这个声明行添加到我的XSLT? 解决方法
只需使用
xsl:output.
例… <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output version="1.0" encoding="UTF-8" standalone="yes"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |