我想在xml文档的开头添加。
所需输出:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.044/cXML.dtd">
<cXML payloadID="1622098213085.433369813.000000243@TzcfvgHhQOcUqW3reWym5GQWUB4=" timestamp="2021-05-26T23:50:13-07:00" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<Response>
<Status code="200" text="OK"/>
</Response>
</cXML>我有下面的XSLT,不知道如何添加
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<cXML version="{/cXML/@version}" payloadID="{/cXML/@payloadID}" timestamp="{/cXML/@timestamp}"
signatureVersion="{/cXML/@signatureVersion}">
<Response Id="{/cXML/Response/@Id}">
<Status code="{/cXML/Response/Status/@code}" text="{/cXML/Response/Status/@text}"/>
</Response>
</cXML>
</xsl:template>
</xsl:stylesheet>我在下面试过了,但它不起作用。
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output doctype-system="http://xml.cxml.org/schemas/cXML/1.2.044/cXML.dtd"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

它可以在其他XSLT测试工具中工作,所以XSLT很好用。

发布于 2021-05-28 05:10:45
使用doctype-system添加xsl:output
<xsl:output doctype-system="http://xml.cxml.org/schemas/cXML/1.2.044/cXML.dtd"/>https://stackoverflow.com/questions/67729868
复制相似问题