Xslt 在ESB中更改xml节点名称
我想更改WSO2 ESB中的xml节点名称,即Xslt 在ESB中更改xml节点名称,xslt,wso2,esb,wso2esb,Xslt,Wso2,Esb,Wso2esb,我想更改WSO2 ESB中的xml节点名称,即 $1 $2 我希望是这样 $1 $2 以项目名称作为属性;我的意思是它们会动态变化。 是否有任何方法可以使用ESB中介进行更改?最后,我使用XSLT中介进行更改,我的中介配置如下: <xslt xmlns="http://ws.apache.org/ns/synapse" key="conf:/users/UsersXSLT.xslt"> <property xmlns:ns="http://org.apache.s
$1
$2
我希望是这样
$1
$2
以项目名称作为属性;我的意思是它们会动态变化。
是否有任何方法可以使用ESB中介进行更改?最后,我使用XSLT中介进行更改,我的中介配置如下:
<xslt xmlns="http://ws.apache.org/ns/synapse" key="conf:/users/UsersXSLT.xslt">
<property xmlns:ns="http://org.apache.synapse/xsd" name="TagName" expression="concat(get-property('OperationName'),'Response')"/>
</xslt>
我为它定义了一个属性,可以在XSLT转换中使用它。
我的XSLT是:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
xmlns="http://www.jdnasir.ac.ir/EMI/UserProxy/"
exclude-result-prefixes="fn">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:param name="TagName"/>
<xsl:template match="MessageStatus">
<xsl:element name="{$TagName}" xmlns="http://www.jdnasir.ac.ir/EMI/UserProxy/">
<xsl:for-each select="/MessageStatus/*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
xslt的棘手部分是
最后,我使用xslt Mediator实现了这一点,我的Mediator配置如下:
<xslt xmlns="http://ws.apache.org/ns/synapse" key="conf:/users/UsersXSLT.xslt">
<property xmlns:ns="http://org.apache.synapse/xsd" name="TagName" expression="concat(get-property('OperationName'),'Response')"/>
</xslt>
我为它定义了一个属性,可以在XSLT转换中使用它。
我的XSLT是:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
xmlns="http://www.jdnasir.ac.ir/EMI/UserProxy/"
exclude-result-prefixes="fn">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:param name="TagName"/>
<xsl:template match="MessageStatus">
<xsl:element name="{$TagName}" xmlns="http://www.jdnasir.ac.ir/EMI/UserProxy/">
<xsl:for-each select="/MessageStatus/*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
xslt中棘手的部分是