删除MULE服务器3.3.0 CE中.xslt中remoteClientAddress字符串中的额外部分?

时间:2013-02-06 05:08:14

标签: xml xslt xsd wsdl mule

在我的MULE服务器3.3.0 CE的configuration.xml中,我将MULE_REMOTE_CLIENT_ADDRESS传递给.xslt文件,下面我复制了我的代码:

    <logger 
  message="#[message.inboundProperties['MULE_REMOTE_CLIENT_ADDRESS']]" 
  level="INFO" doc:name="Logger"/>

要将IP地址传递给XSLT,请将其存储在变量中并传递它。

    <set-variable 
  variableName="remoteClientAddress" 
  value = "#[message.inboundProperties['MULE_REMOTE_CLIENT_ADDRESS']]"/>

将其传递给XSLT:

<xm:xslt-transformer xsl-file="xsltFileName.xslt">
  <xm:context-property 
    key="remoteClientAddress" 
    value="#[remoteClientAddress]"/>
</xm:xslt-transformer>

在我的XSLT中,声明了一个param变量

<xsl:param  name="remoteClientAddress" />

然后将此变量用作

<xsl:value-of select="$remoteClientAddress" />

但在configuration.xml文件中我使用:

<logger message="Remote client address is------> #[remoteClientAddress]" level="INFO" doc:name="Logger"/>

用于检查IP地址,但是在我的MULE控制台中我看到了这样的声明:/127.0.0.1:51708 虽然我需要 127.0.0.1 我在ip-address之前不需要 / ,而在我的ip-address结尾处:51708

如何在mule中删除Configuration.xml中的这些额外部分,然后再发送 ip-address到.xslt文件?

1 个答案:

答案 0 :(得分:2)

我对骡子一无所知,但你可以这样做:

<xsl:param  name="remoteClientAddress" />
<xsl:variable name="remoteClientAddressTrimmed"
       select="substring-before(substring-after($remoteClientAddress, '/'), ':')" />

然后再

<xsl:value-of select="$remoteClientAddressTrimmed" />