Using the ExtractVariables policy, i retrieved the value of a JSON element which is a Boolean and stored it in a variable. When I checked by triggering the API, the value was getting passed to the variable, later after the extract variables policy I used the XSLT transform policy and passed that variable as a parameter ref and used it in the XSL. But the output of the XSL had a blank value for the tag which had it's mapping from this variable. Later in my extract variables policy, I pointed to fetch the different JSON element which had a Non-Boolean value. The output of the XSL had the corresponding tag value with that Non-Boolean value. kindly help.
Maybe a way to get around the problem is to augment the ExtractVariables with a second policy that will coerce the boolean into a string value, before passing it into the XSLT. You could do this with this Javascript:
var s = context.getVariable('variable.name') +''; context.setVariable('variable.name', s);
If that doesn't work, Please show me:
At the moment, am using the same method that is using JavaScript and setting a new variable and then passing the value got from extract variables to it.
In XSL Transform policy, you need to set variable values under parameters section.
eg:
<Parameters ignoreUnresolvedVariables="true">
<Parameter name="firstname" ref="flow.variable.name"/>
<Parameter name="lastname" ref="flow.variable.name"/>
</Parameters>
In XSLT file you can read and access them.
<xsl:param name="firstname"/>
<xsl:param name="lastname"/>
<xsl:value-of select="firstname"/>
<xsl:value-of select="lastname"/>