[英]How to pass a logger message value to .xslt file in mule
In configuration.xml file I implemented a flow for publishing out a wsdl, during the way I put a logger that return Client's IP address. 在configuration.xml文件中,在放置返回客户端IP地址的记录器的过程中,我实现了发布wsdl的流程。 this is my code:
这是我的代码:
<logger message="#[groovy:message.getInboundProperty('MULE_REMOTE_CLIENT_ADDRESS')]" level="INFO" doc:name="Logger"/>
Now I want to transfer(pass) ip address to my .xslt file? 现在我想将IP地址传输(传递)到我的.xslt文件吗? How can I do it?
我该怎么做?
If you're using Mule 3.3, you can utilize MEL and simplify logger statement like this: 如果您使用的是Mule 3.3,则可以利用MEL并简化记录器语句,如下所示:
<logger message="#[message.inboundProperties['MULE_REMOTE_CLIENT_ADDRESS']]" level="INFO" doc:name="Logger"/>
To pass IP address to XSLT, store it in a variable and pass that. 要将IP地址传递给XSLT,请将其存储在变量中并传递它。
<set-variable variableName="remoteClientAddress" value = "#[message.inboundProperties['MULE_REMOTE_CLIENT_ADDRESS']]"/>
Display with logger 与记录器一起显示
<logger message="Remote client address is------> #[remoteClientAddress]" level="INFO" doc:name="Logger"/>
Pass it to XSLT
as: 通过以下方式将其传递给
XSLT
:
<xm:xslt-transformer xsl-file="xsltFileName.xslt">
<xm:context-property key="remoteClientAddress" value="#[remoteClientAddress]"/>
</xm:xslt-transformer>
In your XSLT
, declare a param variable 在您的
XSLT
,声明一个param变量
<xsl:param name="remoteClientAddress" />
and then use this variable as 然后将此变量用作
<xsl:value-of select="$remoteClientAddress" />
对于与正确提取IP地址有关的问题,请使用XSLT函数,例如
substring-before() , substring-after() and tokenize() ( in XSLT 2.0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.