Boolean Values aren't getting passed into XSLT as a reference parameter. Could you please help?

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.

0 3 777
3 REPLIES 3

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:

  • A trace (screenshot?) showing the context variable containing the boolean value
  • The XSLT policy configuration where you have the Parameter element
  • The XSLT sheet itself, where you have the xsl:param element

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.

@Aiyappa M B

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"/>