Page 1 of 1

can user input be passed to external tools?

Posted: Mon Jan 27, 2014 4:16 pm
by Ron Van den Branden
For a project, I have set up an Ant transformation that invokes different XSLT stylesheets depending on some choices offered to the user. Those choices are passed as Ant parameters, via a dialog that's generated with the ${ask('message', type, ('real_value1':'rendered_value1'; 'real_value2':'rendered_value2'; ...), 'default_value')} editor variable.

Yet, since probably more transformation scenarios will be required, I am considering if a dedicated menu button for each transformation wouldn't be easier for the project contributors. The simplest form (I can't program Java) seems the definition of such an action as an "external tool" that invokes Ant. However, can external tools make use of the editor variables that are available to XSLT/Ant transformations? In other words: is there a way to ask for user input with external tools? Or should I consider another option to provide this action in a dedicated button?

Best,

Ron

Re: can user input be passed to external tools?

Posted: Mon Jan 27, 2014 6:08 pm
by Radu
Hi Ron,

We have Java-based API which would allow you to build a plugin which contributes additional toolbar buttons, each button invoking a certain transformation scenario.
The external tools drop down can only invoke command lines defined in the External Tools Preferences page. When you edit an external tool, you can see for each field what editor variables are supported. Also they cannot invoke a certain transformation scenario.

Do the contributors edit the XML documents in the Author visual editing mode? Did you define a document type association for it? If so, I could give you a workaround which would not require Java knowledge.

Regards,
Radu

Re: can user input be passed to external tools?

Posted: Mon Jan 27, 2014 6:43 pm
by Ron Van den Branden
Hi Radu,

I assume even a Java-illiterate like me could give the Java option a try/err, by copying/pasting from the documentation and e.g. the TEI framework.

Still, the other option you mentioned could just fit the bill, I'm very curious! Both conditions are fulfilled: the contributors edit in Author mode, and a document type association is defined in the xpr file.

Best,

Ron

Re: can user input be passed to external tools?

Posted: Tue Jan 28, 2014 10:18 am
by Radu
Hi Ron,
Still, the other option you mentioned could just fit the bill, I'm very curious! Both conditions are fulfilled: the contributors edit in Author mode, and a document type association is defined in the xpr file.
Great. You go to the Oxygen Preferences->Document Type Association page and edit your custom document type. In the Author tab go to the Actions tab and create a new action. Set an ID ("pdf.transform" for example), name ("PDF" for example or "XHTML") and description (will appear on tooltip). In the bottom Operations panel set the activation XPath expression to true() and use the Choose button to find an operation called ExecuteTransformationScenariosOperation. This operation has an argument called scenarioNames which should have as value the name of the transformation scenario to run when the action is executed.

After the action is created, go to the Toolbar tab and add it to the toolbar which will be shown when that type of XML document is edited in the visual Author editing mode.

In the same "Document type" edit dialog there is a Transformation tab in which you can create predefined transformation scenarios for your type of edited XML documents, scenarios which are then referenced by name from the action you have created.

You can try these steps and if you find a problem, just let me know and I'll try to provide more details.

Regards,
Radu

Re: can user input be passed to external tools?

Posted: Tue Jan 28, 2014 4:32 pm
by Ron Van den Branden
Hi Radu,

Wonderful, works like a charm! Thanks for your detailed help, you've pointed me to customized menus etc. at once.

Best,

Ron