-6ren"> -您好,我正在通过将 xsl 应用于 xml 输入来生成 xml。我需要没有这部分的输出 "" 输入--xml RIM_BPS -6ren">
gpt4 book ai didi

xml - 需要从 xml 中删除

转载 作者:数据小太阳 更新时间:2023-10-29 01:37:55 25 4
gpt4 key购买 nike

您好,我正在通过将 xsl 应用于 xml 输入来生成 xml。我需要没有这部分的输出 "<?xml version="1.0" encoding="utf-16"?>"

输入--xml

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<CreateResponse xmlns="http://jerseytelecom.com/">
<CreateResult>
<ISD_XMLGateway>
<Entity>RIM_BPS</Entity>
</ISD_XMLGateway>
</CreateResult>
</CreateResponse>
</soap:Body>
</soap:Envelope>

我的xsl

    <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:JT="http://jerseytelecom.com/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="JT">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:element name="Entity">
<xsl:value-of select="soap:Envelope/soap:Body/JT:CreateResponse/JT:CreateResult/JT:ISD_XMLGateway/JT:Entity"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

当前输出

   <?xml version="1.0" encoding="utf-16"?>
<Entity>RIM_BPS</Entity>

预期输出

    <Entity>RIM_BPS</Entity>

最佳答案

尝试将 omit-xml-declaration="yes" 属性添加到您的 xsl:output 标记。

它应该是这样的:

<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />

关于xml - 需要从 xml 中删除 <?xml version ="1.0"encoding ="utf-16"?>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14800746/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com