Passing XSLT stylesheet parameter to transform scenario?

Here should go questions about transforming XML with XSLT and FOP.
dsewell
Posts: 115
Joined: Mon Jun 09, 2003 6:02 pm
Location: Charlottesville, Virginia USA

Passing XSLT stylesheet parameter to transform scenario?

Post by dsewell » Tue Apr 06, 2010 12:13 am

When I am creating an XSLT transformation scenario, I would like to be able to use one of the stylesheet parameters (defined in the XSLT tab) in constructing the name of the output file. So for example if I set parameter ID=X123, I would like to define "Save As" using something like

Code: Select all

Myfile-${param(ID)}.xml
to produce the file Myfile-X123.xml.
Is this possible?

adrian
Posts: 2585
Joined: Tue May 17, 2005 4:01 pm

Re: Passing XSLT stylesheet parameter to transform scenario?

Post by adrian » Tue Apr 06, 2010 12:45 pm

Hello,

Unfortunately right now there is no editor variable that can be used to obtain what you want.

An arguable workaround would be to use an environment variable - ${env(VAR_NAME)} - or a java system variable - ${system(var.name)} - in both the stylesheet parameter value and in the "Save As" field and then set that variable before starting Oxygen. I'm not sure that's very helpful since I'm guessing you wanted a fast way to change both the parameter and the output file name.

Should I consider this a feature request(improvement)?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

dsewell
Posts: 115
Joined: Mon Jun 09, 2003 6:02 pm
Location: Charlottesville, Virginia USA

Re: Passing XSLT stylesheet parameter to transform scenario?

Post by dsewell » Tue Apr 06, 2010 4:25 pm

Yes, please create a feature request for a new editor variable that can use the active stylesheet parameters.

adrian
Posts: 2585
Joined: Tue May 17, 2005 4:01 pm

Re: Passing XSLT stylesheet parameter to transform scenario?

Post by adrian » Wed Apr 07, 2010 4:16 pm

Hi,

Ok, I've added this as a feature request.
We'll let you know when this gets implemented.

Thank you for the feedback.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

adrian
Posts: 2585
Joined: Tue May 17, 2005 4:01 pm

Re: Passing XSLT stylesheet parameter to transform scenario?

Post by adrian » Thu Aug 05, 2010 3:49 pm

Hi,

There is a workaround that can help you by using a custom editor variable.
If you go to Options -> Preferences - Custom Editor Variables you can define a custom editor variable.
e.g.
Name: myParam
Value: X123

Then you can use this editor variable as the parameter's value: ${myParam}
And in the 'Save As' field: Myfile-${myParam}.xml

Then if you ned to change the value you can simply edit the value of the custom editor variable.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Post Reply