Page 1 of 1

Cannot pass static parameters to XSLT refactoring operation

Posted: Tue Dec 20, 2022 12:21 am
by chrispitude
In refactoring operations, I would like to allow the user to turn some features on and off. So I tried defining some static stylesheet parameters, then used them to enable templates with use-when:

Code: Select all

<xsl:param name="remove.rev" as="xs:boolean" select="true()" static="yes"/>

<xsl:template use-when="$remove.rev"
  match="...">
  ...
</xsl:template>
However, Oxygen gives me the following error when running the stylesheet from Oxygen's refactoring operation window:

Code: Select all

Parameter $remove.rev cannot be supplied dynamically because it is declared as static
But if I run it from the command line, it works:

Code: Select all

java -jar ~/saxon/saxon-he-11.4.jar -s:OPENME2.dita -xsl:refactoring/post-release-cleanup.xsl
then it works.

Am I doing something wrong? I found a similar issue here:

Configure transformation scenarios boolean

but I am not sure if it is the same issue.

Here is a testcase:

oxygen_refactoring_static_params.zip

Re: Cannot pass static parameters to XSLT refactoring operation

Posted: Tue Dec 20, 2022 9:10 am
by Radu
Hi Chris,

I added this internal issue based on your feedback:
EXM-52078 Cannot run XML refactoring scripts which use static params

Static parameters need to be set very early in the XSLT processor code, before the stylesheet is compiled, so right now we do not support setting static parameters.
Somehow we would need either to read the XSLT stylesheet before compiling it and find out what parameter is defined as static or not, or add some kind of attribute in the XML refactoring script on the <parameter> element to declare it as static so that we can know what parameters to set as static and what parameters to set as regular params.

Regards,
Radu