Connect oxy_actions and transformations scenario for XSLT
Oxygen general issues.
-
- Posts: 84
- Joined: Wed Jul 19, 2017 6:04 pm
- Location: Austria
- Contact:
Connect oxy_actions and transformations scenario for XSLT
Hi!
I'm building a simple GUI for convenient XSLT-transformations in oXygen. The GUI is am xml file and I use form-controls to inset the parameters and oxygen actions to run the transformations. For instance, there is the following button in the CSS:
I faced a problem that with pure XSLT you cannot overwrite the file which you read, cf. https://stackoverflow.com/q/56472663/7315908.
But in oXygen you can do it when you use the scenario. So I thought maybe there is any possibility to use this feature for my approach?
best Oleksii
I'm building a simple GUI for convenient XSLT-transformations in oXygen. The GUI is am xml file and I use form-controls to inset the parameters and oxygen actions to run the transformations. For instance, there is the following button in the CSS:
Code: Select all
button[name = "mergeStaves"]:before {
content:
oxy_button(actionID, 'mergeStaves');
}
I faced a problem that with pure XSLT you cannot overwrite the file which you read, cf. https://stackoverflow.com/q/56472663/7315908.
But in oXygen you can do it when you use the scenario. So I thought maybe there is any possibility to use this feature for my approach?

best Oleksii
Kind regards,
Oleksii Sapov-Erlinger
Oleksii Sapov-Erlinger
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Connect oxy_actions and transformations scenario for XSLT
Post by alex_jitianu »
Hi Oleksii,
I've tried to execute such a transformation from Oxygen, with Saxon 9.8, but it didn't actually work. I got the error message:
If, for whatever reasons, the scenario approach is not an options, you can create your own custom operation . This operation can use the API to create a new transformer and execute it:
Best regards,
Alex
I've tried to execute such a transformation from Oxygen, with Saxon 9.8, but it didn't actually work. I got the error message:
Code: Select all
Cannot write to a URI that has already been read: file:/D:/projects/eXml/samples/dita/xslt/input.xml
I'm not aware about anything specific that we might do to allow such a behavior, but if you want to try it, the fastest way would be to configure an action that uses the ro.sync.ecss.extensions.commons.operations.ExecuteTransformationScenariosOperation to execute an already configured transformation scenario.But in oXygen you can do it when you use the scenario.
If, for whatever reasons, the scenario approach is not an options, you can create your own custom operation . This operation can use the API to create a new transformer and execute it:
Code: Select all
ro.sync.ecss.extensions.api.AuthorAccess.getXMLUtilAccess()
ro.sync.exml.workspace.api.util.XMLUtilAccess.createSaxon9XSLTTransformerWithExtensions(Source, ExtensionFunctionDefinition[], int)
Alex
-
- Posts: 84
- Joined: Wed Jul 19, 2017 6:04 pm
- Location: Austria
- Contact:
Re: Connect oxy_actions and transformations scenario for XSLT
Hi Alex,
I already use the action
There is obviously a problem with resolving the namespace (?) because this expression works fine:
It tested first by defining a parameter and printing out a message. When I wanted to define it in the XML URL a strange behaviour is occured: a part of the expression is replaced by '*':
Should it still work?
best regards
Oleksii
I already use the action
The button which fires the action is placed in another xml file which is a kind of GUI from which I want to run all the transformations. The file which should be processed is defined in a @file attribute as relative path. So when running the transformation, I try to get this value by :...ExecuteTransformationScenariosOperation
Code: Select all
${xpath_eval(
doc('${currentFileURL}')//{http://www.mozarteum.at/ns/dme}div[@id = 'mergeStaves']//{http://www.mozarteum.at/ns/dme}file/@file
)}
Code: Select all
${xpath_eval(
doc('${currentFileURL}')//@file
)}
Code: Select all
${xpath_eval(doc('${currentFileURL}')//{http://www.mozarteum.at/ns/dme}div[@id = 'mergeStaves']//{http:*****************************@file
best regards
Oleksii
Kind regards,
Oleksii Sapov-Erlinger
Oleksii Sapov-Erlinger
-
- Posts: 417
- Joined: Mon May 09, 2016 9:37 am
Re: Connect oxy_actions and transformations scenario for XSLT
Post by sorin_carbunaru »
Hello Oleksii,
Could you please try the solution from https://stackoverflow.com/a/55181151/1288460 (preceding the namespace with 'Q') and then let me know if it worked for you? We tried something quick on our side and it seemed to work
.
Best wishes,
Sorin Carbunaru
oXygen XML
P.S. - Alex is on vacation
Could you please try the solution from https://stackoverflow.com/a/55181151/1288460 (preceding the namespace with 'Q') and then let me know if it worked for you? We tried something quick on our side and it seemed to work

Best wishes,
Sorin Carbunaru
oXygen XML
P.S. - Alex is on vacation
-
- Posts: 84
- Joined: Wed Jul 19, 2017 6:04 pm
- Location: Austria
- Contact:
Re: Connect oxy_actions and transformations scenario for XSLT
Hi Sorin,
The adding of the Q before the Clark notation works well!
Currently I can specify the XMLURL as relative path. by:
The next problem I faced is to specify the output URL. I tried to specify the following in the Output >> Save as of the XSLT transformation dialog box:
The error I gets is:
To make it clearer: I try to run a transformation with an oxy_button from
C:\...\repos_develop_os\trunk_branch-os\util\xslt_oxygen\lib\DIME-tools.xml
The transformed file is placed in:
C:\...\repos_develop_os\sandbox_os\MRE\dmeref_543-004_6252-3456.xml
and the XSLT stylesheet in:
C:\...\repos_develop_os\trunk_branch-os\util\xslt_oxygen\reference_texts\mergeStaves.xsl
P.S . So I wish Alex a great sunny time
The adding of the Q before the Clark notation works well!
Currently I can specify the XMLURL as relative path. by:
Code: Select all
${xpath_eval(
doc('${currentFileURL}')//Q{http://www.mozarteum.at/ns/dme}div[@id = 'mergeStaves']//@file
)}
Code: Select all
${xpath_eval(
resolve-uri(
doc('${currentFileURL}')//Q{http://www.mozarteum.at/ns/dme}div[@id = 'mergeStaves']//@file, ${currentFileURL})
)}
Also it adds the fileCannot delete the file: C:\Users\...\xslt_oxygen\lib prior to result generation.
.DIME-tools.xml_xslt
To make it clearer: I try to run a transformation with an oxy_button from
C:\...\repos_develop_os\trunk_branch-os\util\xslt_oxygen\lib\DIME-tools.xml
The transformed file is placed in:
C:\...\repos_develop_os\sandbox_os\MRE\dmeref_543-004_6252-3456.xml
and the XSLT stylesheet in:
C:\...\repos_develop_os\trunk_branch-os\util\xslt_oxygen\reference_texts\mergeStaves.xsl
P.S . So I wish Alex a great sunny time

Kind regards,
Oleksii Sapov-Erlinger
Oleksii Sapov-Erlinger
-
- Posts: 84
- Joined: Wed Jul 19, 2017 6:04 pm
- Location: Austria
- Contact:
Re: Connect oxy_actions and transformations scenario for XSLT
I solved the problem by specifying the in the Output >> Save as of the XSLT transformation dialog box :
So the same as in the input.
Code: Select all
${xpath_eval(
doc('${currentFileURL}')//Q{http://www.mozarteum.at/ns/dme}div[@id = 'mergeStaves']//@file
)}
Kind regards,
Oleksii Sapov-Erlinger
Oleksii Sapov-Erlinger
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Connect oxy_actions and transformations scenario for XSLT
Post by alex_jitianu »
Hi Oleksii,
I'm glad to see that you've made progress. Please let me know if you encounter any other challenges.
Best regards,
Alex
I'm glad to see that you've made progress. Please let me know if you encounter any other challenges.
Best regards,
Alex
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service