【问题标题】:XSLT transformation of soap肥皂的 XSLT 转换
【发布时间】:2013-10-11 13:09:44
【问题描述】:

我有这个 xml 文件

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tes="http://testwork/">
   <soapenv:Header/>
   <soapenv:Body>
      <tes:sayHelloWorldFrom>
         <!--Optional:-->
         <arg0>?</arg0>
      </tes:sayHelloWorldFrom>
   </soapenv:Body>
</soapenv:Envelope>

我想用xslt转换提取body,我的xsl是

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
    xmlns:m="http://www.example.org/stock">
    <xsl:template match="/">
        <xsl:apply-templates select="soapenv:Envelope/soapenv:Body/*"/>
    </xsl:template>
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

但在转换过程中出现错误

Unable to perform XSL transformation on your XML file. null

我的 xsl 出了什么问题?

【问题讨论】:

    标签: xslt soap transformation


    【解决方案1】:

    您的 XSL 缺少 XML 中的名称空间。没有它,您的 XSL 将无法在 XML 中找到您的元素,因为它会在错误的命名空间中查找它。

    所以添加

    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:tes="http://testwork/"
    

    到您的 XSL,它应该可以毫无问题地转换。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-07
      • 2018-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-27
      相关资源
      最近更新 更多