Search code examples
xpathwso2wso2-enterprise-integrator

Can i use complex condition using XPath in Filter Mediator WSO2?


I have a condition written in SQL Language that i would like to use it in Filter Mediator XPath but it didn't work and it give me an error .

NB : I got variable value from JSON payload .

Actual SQL Condition

(!ISNULL(a) && a== 2 && b== 1) || c== 5

Expected XPath Condition

(//a=2 AND //b=1) OR //c=5

Solution

  • Try the following.

    <filter xpath="boolean(//a/text() = '1' and //b/text() = '2') or //c/text() = '3'">
        <then>
            <log>
                <property value="===== TRUE" name="MSG"/>
            </log>
        </then>
        <else>
            <log>
                <property value="===== FALSE" name="MSG"/>
            </log>
        </else>
    </filter>