具有名称空间的wso2 xslt中介

具有名称空间的wso2 xslt中介,wso2,wso2esb,Wso2,Wso2esb,我们希望使用xslt中介在其他语言中转换xml。 我们有这个soap消息 <?xml version = "1.0" encoding="ISO-8859-1"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.es"> <soapenv:Header/> <soapenv:Body>

我们希望使用xslt中介在其他语言中转换xml。 我们有这个soap消息

  <?xml version = "1.0" encoding="ISO-8859-1"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.es">
   <soapenv:Header/>
   <soapenv:Body>
      <ws:reception>
         <ws:xml>
           <message>Data messsage to send</message>
         </ws:xml>
      </ws:reception>
   </soapenv:Body>
</soapenv:Envelope>

要发送的数据消息
我们希望得到这个信息

  <?xml version = "1.0" encoding="ISO-8859-1"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.es">
   <soapenv:Header/>
   <soapenv:Body>
      <ws:reception>
         <ws:xml>
           <![CDATA[<message>Data messsage to send]]></message>
         </ws:xml>
      </ws:reception>
   </soapenv:Body>
</soapenv:Envelope>

要发送的数据消息]]>
我们正在使用这个xslt模板

<?xml version = "1.0" encoding = "ISO-8859-1"?> 
<xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">

   <xsl:template match = "//ws:xml"> 
    <xsl:copy>
        <xsl:text disable-output-escaping="yes"> &lt;![CDATA[</xsl:text>
             <xsl:copy-of select="*"/>
         <xsl:text disable-output-escaping="yes"> ]]&gt;</xsl:text>
    </xsl:copy>   
    </xsl:template>  
</xsl:stylesheet>

![CDATA[
]]
但它不起作用

有人能帮我们吗


提前感谢。

您的两个文件完全相同。但如果我认为你想改变是对的

<message>Data messsage to send</message>
要发送的数据消息
进入


如果是,请尝试以下方法:

已编辑代码以反映更新的问题


![CDATA[
]]      

不过,请注意,Michael Kay会因为您使用了
禁用输出转义

而对您大喊大叫,我很抱歉。我们需要Menssage数据]]>好的,谢谢。但是,如果我们在消息xml标记中包含一个xml标记,则此模板将删除该标记,并且它只显示标记的内容,如data]]]>..,它应该显示…..data]]>..好的,如果我使用xsl:copy of而不是xsl:value of,我们就得到了我们想要的。非常感谢您的快速回答和提示。
<message><![CDATA[Data messsage to send]]></message>
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="message">
    <xsl:text disable-output-escaping="yes"> &lt;![CDATA[</xsl:text>
    <message>
        <xsl:value-of select="//message"/>
    </message>
    <xsl:text disable-output-escaping="yes"> ]]&gt;</xsl:text>      
</xsl:template>