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. 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? How can I do it?
If you're using Mule 3.3, you can utilize MEL and simplify logger statement like this:
<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.
<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:
<xm:xslt-transformer xsl-file="xsltFileName.xslt">
<xm:context-property key="remoteClientAddress" value="#[remoteClientAddress]"/>
</xm:xslt-transformer>
In your XSLT
, declare a param variable
<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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.