Cannot pass static parameters to XSLT refactoring operation

Questions about XML that are not covered by the other forums should go here.
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Cannot pass static parameters to XSLT refactoring operation

Post 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
(3.21 KiB) Downloaded 77 times
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Cannot pass static parameters to XSLT refactoring operation

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply