MULE中.xslt文件中的if -else条件 [英] if -else condition in .xslt file in MULE
问题描述
在MULE服务器3.3.0的configuration.xml中,我将MULE_REMOTE_CLIENT_ADDRESS传递到.xslt文件,在下面复制了我的代码:
In my configuration.xml in MULE server 3.3.0 I pass MULE_REMOTE_CLIENT_ADDRESS to .xslt file, below I copied my codes :
<logger
message="#[message.inboundProperties['MULE_REMOTE_CLIENT_ADDRESS']]"
level="INFO" doc:name="Logger"/>
要将IP地址传递给XSLT,请将其存储在变量中并传递给它.
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']]"/>
通过以下方式将其传递到XSLT:
Pass it to XSLT as:
<xm:xslt-transformer xsl-file="xsltFileName.xslt">
<xm:context-property
key="remoteClientAddress"
value="#[remoteClientAddress]"/>
</xm:xslt-transformer>
在我的XSLT中,声明了一个param变量
In my XSLT, declared a param variable
<xsl:param name="remoteClientAddress" />
,然后将此变量用作
<xsl:value-of select="$remoteClientAddress" />
现在,我想检查.xslt文件中的 $ remoteClientAddress ,如果它等于特定的ip_address,则可以更改我的XML(WSDL)文件,并且它不等于空发生在我的XML(WSDL)文件中.
Now I want to check $remoteClientAddress in .xslt file, that if it was equal to specific ip_address, then I could change in my XML(WSDL) file and if it wasn't equal nothing happen in my XML(WSDL) file.
我该怎么办?
推荐答案
根据您之前发表的文章,我的理解是,如果此匹配为true,则您希望省略输入XML的特定部分.在这种情况下,(添加到您现有的XSLT中),以下应该可以实现:
Based on previous posts you've made, my understanding is that you want to omit a particular part of the input XML if this match is true. In that case, the following should be able to accomplish that (when added to your existing XSLT):
<xsl:template match="wsdl:operation[@name = 'GetISD']">
<xsl:variable name="rcaTrimmed"
select="substring-before(substring-after($remoteClientAddress, '/'), ':')" />
<xsl:if test="$rcaTrimmed != '123.12.12.123'">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:if>
</xsl:template>
仅当$remoteClientAddress
不等于指定的地址时,此操作才会 include .
This will include the operation only if the $remoteClientAddress
is not equal to the specified address.
这篇关于MULE中.xslt文件中的if -else条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!