Transformations, parameters and additional stylesheets

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
ra0543
Posts: 77

Transformations, parameters and additional stylesheets

Wed Apr 27, 2011 12:00 pm

I have an XSLT transformation scenario set up with one parameter (the value is ${ask('Include notes? y/n',generic,'n')}) and one additional stylesheet. When I run the transformation, I am prompted for the input for the parameter twice, apparently once for each stylesheet. Since the additional stylesheet doesn't make reference to parameters, the first input is used as I would expect with the first stylesheet while the second input is not used in any way.

To be honest, I'm not really sure why it is being requested. Is this a bug or expected behaviour? If it's expected, it would maybe help if the prompt window at least clarified which stylesheet the parameter was being requested for, since at present the second prompt is identical in every way to the first. If the idea is for it to be possible to set parameters for each additional stylesheet in a transformation scenario, perhaps they should be set from a dialogue box attached to each individual stylesheet, rather than all being asked for in respect of every stylesheet in the transformation. The current parameter setting process could be used for a more 'global' parameter, i.e. one that has a single value made use of in any of the stylesheets within the scenario.
adrian
Posts: 2326

Re: Transformations, parameters and additional stylesheets

Wed Apr 27, 2011 2:35 pm

Hello,

All the parameters from the transformation scenario are passed to each of the stylesheets(main and additional ones) whether they are used or not.
The bug here is that the ${ask} macro should have been evaluated only once when the transformation scenario started.

I've added this to our issue tracking tool and it will be resolved in a future version of Oxygen. Hopefully this will be fixed in time for v12.2.

Thank you for letting us know about this.

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

Re: Transformations, parameters and additional stylesheets

Tue Jun 20, 2017 4:35 am

This is a really old thread, but I have a related issue. I have a transformation scenario and one additional XSLT stylesheet (two stylesheets processed in series, which is an awesome feature). When I setup this scenario from the editor view ("Configure Transformation Scenario(s)" dialog box), I see the parameters across both stylesheets. However, when I set it up as part of a framework (custom document type, transformations tab), I only see the parameters from the main/first stylesheet (the one identified in the "XSL URL" field of the "Edit scenario" dialog box). By "see the parameters" I mean when I press the "Parameters(0)" button in the "Edit scenario" dialog box.
sorin_carbunaru
Site Admin
Posts: 111

Re: Transformations, parameters and additional stylesheets

Tue Jun 20, 2017 9:47 am

Hello,

I have just tried out your scenario in 2 different version of oXygen XML Editor (19.0 and 17.0) and I had both parameters available, even when creating the transformation scenario as part of a framework.

Perhaps in your case oXygen cannot detect the additional stylesheet. If you are manually composing the path to the additional stylesheet, try also to browse for the XSL document using oXygen's file chooser. This is how I referred it and it worked.

You could also post a screenshot with how you refer the additional XSL file. Then we can also try a similar approach and see if it works for us. Or maybe we can spot a problem with the URL.

All the best wishes,
Sorin Carbunaru
oXygen XML
avanlooveren
Posts: 25

Re: Transformations, parameters and additional stylesheets

Tue Jun 20, 2017 8:06 pm

Sorin,

Thanks for looking at this. I didn't even suspect the path/URL. Indeed, the use of the editor variable ${framework} in the path for the additional XSLT stylesheet was the problem. Giving a fully qualified path fixed that issue.

To be clear, I was actually using a path like this: "${framework}/../../transformations/masterCourse_filter.xsl". This technique is currently working under the Author>CSS, Schema, and Transformation>Scenario>XSL URL tabs in the framework. So, I don't know if the editor variable, the parent directory elements (".."), or the combination are to blame for the issue, but not being able to make framework relative URLs in this one place is unfortunate and inconsistent. BTW, this is Editor Professional 19.0.

Please let me know if there is a better workaround (for now I will use the fully expanded path) or a fix will be queued. Thanks again!

-Andre
avanlooveren
Posts: 25

Re: Transformations, parameters and additional stylesheets

Tue Jun 20, 2017 8:16 pm

I just wanted to add that even with the use of the editor variable in the framework transformation scenario, the additional XSLT stylesheet did execute properly, granted, with the default param values.
sorin_carbunaru
Site Admin
Posts: 111

Re: Transformations, parameters and additional stylesheets

Wed Jun 21, 2017 10:22 am

Hello Andre,

I reproduced the problem on my side using the ${framework} editor variable, and consequently I created an issue on our side. This thread will be updated when a kit fixing the issue will be available.

What you could do is to manually add the parameters in the table from the Configure parameters dialog, using the New button. This way you avoid using absolute paths.

Regards,
Sorin C.
avanlooveren
Posts: 25

Re: Transformations, parameters and additional stylesheets

Thu Jun 22, 2017 2:12 am

Thanks, Sorin.

One point of clarification... The parameters are not displayed as associated with specific stylesheets (two in my case) in the scenario, so is it true that any shared parameter names must be uniform across the stylesheets? That is, will multiple stylesheets have to share the same value for the parameter if the parameter names are the same? This isn't a problem for me, but I am curious and it may help others to know this information.

One further point of clarification, when selecting the checkbox for XPath, is the expression evaluated on each stylesheet as they are processed or is the value determined from the first stylesheet and then used for all subsequent ones? The latter case is more consistent with the ${ask} editor variable behavior, but I think the former is more powerful.

-Andre
sorin_carbunaru
Site Admin
Posts: 111

Re: Transformations, parameters and additional stylesheets

Thu Jun 22, 2017 12:14 pm

Hello Andre,

After trying your scenarios on my PC, I reached the following conclusions:
1. Multiple stylesheets share the same value for the parameters if the parameter names are the same.
2. If a parameter's value is actually an XPath expression, then the expression is evaluated for each stylesheet.

Could you please tell us your use case? What exactly are you trying to do? Maybe we can help you with some ideas and pieces of advice.

Sorin C.
avanlooveren
Posts: 25

Re: Transformations, parameters and additional stylesheets

Thu Jun 22, 2017 9:53 pm

Sorin, you and your team are awesome! You guys always help with ideas and advice.

I don't have a current use case in mind. I was asking the question for myself and the community (not finding reference to this particular topic elsewhere) in order to understand the expected behavior in the event someone wants to design transformation scenarios with multiple stylesheets around this knowledge. I might take advantage of this behavior in the future, but for now I'm good. I'll add that my question comes naturally from my exploration of oXygenXML and continued surprise at how powerfully flexible it is. Just getting serial stylesheet processing with so little configuration effort put a smile on my face. XPath evaluation on each step/stylesheet is a bonus!
avanlooveren
Posts: 25

Re: Transformations, parameters and additional stylesheets

Wed Jun 28, 2017 11:17 pm

I wanted to add that regardless of having "Evaluate as XPath" checked or not, with additional stylesheets in a transformation scenario, ${ask} will prompt you once for each stylesheet, which is a bit annoying.
sorin_carbunaru
Site Admin
Posts: 111

Re: Transformations, parameters and additional stylesheets

Thu Jun 29, 2017 12:11 pm

Hello,

I added your vote on an already existing issue (EXM-20817 - for reference purposes). We'll update this thread when we'll improve the behavior.

Regards,
Sorin Carbunaru
oXygen XML
sorin_carbunaru
Site Admin
Posts: 111

Re: Transformations, parameters and additional stylesheets

Mon Oct 02, 2017 4:52 pm

Hello,

oXygen 19.1 is available. Now the $ask() variable is evaluated only once even if it is used in multiple additional stylesheets.

All the best wishes,
Sorin Carbunaru
oXygen XML

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 1 guest