Page 1 of 1

Configure transformation scenarios boolean

Posted: Tue Nov 17, 2020 1:34 pm
by whyme
I think I've followed the instructions for Configure Transformation Scenarios > Edit scenario > Parameters > Configure Parameters > Edit correctly. I am trying to pass a value to a parameter that takes a boolean. But no matter what I type, true(), true, 1, ${xpath_eval(true())}, exists(/*) I get an error. Yes, I've checked the Evaluate as XPath box.

It seems that whatever I enter into the Oxygen options is still being interpreted as a string, because the Configure parameters list shows apostrophe marks surrounding the value of the parameter I just picked.

Or is there some secret I just don't see? This is version 22.1 build 2020061102.

Re: Configure transformation scenarios boolean

Posted: Wed Nov 18, 2020 9:49 am
by tavy
Hello,

Thanks for your feedback.
In order to be interpreted as a boolean you can set the value of the parameter as true(), and check the Evaluate as XPath box. Even if the value is presented with quotes in the parameters dialog, it will be interpreted as a boolean value.
For example, If I run the following XSLT with the value of the "isPram" set to true(), the text "Param is set" will be displayed in the output.

Code: Select all

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
    <xsl:param name="isParam"/>
    <xsl:template name="xsl:initial-template">
        <xsl:if test="$isParam">Param is set</xsl:if>
    </xsl:template>
</xsl:stylesheet>
Best Regards,
Octavian

Re: Configure transformation scenarios boolean

Posted: Wed Nov 25, 2020 9:48 am
by whyme
After some diagnostics it seems that the error occurs specifically with static params. Your example code works, but not if you add static="yes" to <xsl:param>. If you haven't reconfigured the transformation scenario, the warning/error will read Parameter $isParam cannot be supplied dynamically because it is declared as static but if you unset the parameter and rebind it, running the scenario will produce this error message: The required item type of the value of variable $isParam is xs:boolean; the supplied value "true()" does not match. The supplied value is of type xs:string.

Re: Configure transformation scenarios boolean

Posted: Wed Nov 25, 2020 5:28 pm
by tavy
Hello,

Thanks for the feedback.
Yes, it seems to be a problem when you set a static parameter from the transformation scenario. We already have an issue on our internal issue tracker for this problem. I will add your comment on the issue and increase its priority. When it will be fixed we will update this thread,
I reproduce the problem only if the type of the parameter is set to "xs:boolean". Something like this:

Code: Select all

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xsl:param name="isParam" static="yes" as="xs:boolean"/>
    <xsl:template name="xsl:initial-template">
        <xsl:if test="$isParam">Param is set</xsl:if>
    </xsl:template>
</xsl:stylesheet>
Best Regards,
Octavian