Custom refactoring - creating an output file

Oxygen general issues.
proxx
Posts: 6
Joined: Wed Dec 16, 2015 3:49 pm

Custom refactoring - creating an output file

Post by proxx »

Is it possible to use XML Refactoring Tool to run a XSL script that creates a new output file instead of refactoring files in the ditamap hierarchy?
I know that this is not a real purpose of the Refactoring Tool, but it would be a useful addition.

I would like to iterate over files in the ditamap heirarchy and generate an output file based on information from files.
Radu
Posts: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: Custom refactoring - creating an output file

Post by Radu »

Hi,

You can use xsl:result-document in the XSLT to write to a file. But the XSLT refactoring is applied individually on each topic so you cannot collect information from all files and write that to a single file.
To do what you want maybe you can write an XSLT which takes the main DITA Map as input, resolves the topicrefs recursively using the XSLT "document" function, loads each topic and creates a statistic at the end. Something similar to what out DITA Metrics report project does:

https://github.com/oxygenxml/dita-metrics-report

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
proxx
Posts: 6
Joined: Wed Dec 16, 2015 3:49 pm

Re: Custom refactoring - creating an output file

Post by proxx »

Hi Radu,

Thanks for your advice.
Yes, iterating using document() or doc() functions was my initial approach, but it seems pretty cumbersome to implement with XSL. Especially that topics can live on different levels in the document tree. That's why I thought about utilizing Oxygen's search engine over ditamap hierarchy.
I will check the dita-metrics project though.

Another XML Refactoring Tool advantage is that it is easy to access and use for everyone. It would be less confusing for some people to run a script from there, instead of from XSLT tab.
Is there any other mechanism in Oxygen to share XSL scripts similarly to what XML Refactoring Tool offers?

Take care,
Wojtek
Radu
Posts: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Re: Custom refactoring - creating an output file

Post by Radu »

Hi Wojtek,

You can create transformation scenarios and share them with your team mates (Options menu->Export global transformation scenarios) along with the XSLTs.
Or create an Oxygen project which contains the XSLTs + transformation scenarios saved at project level.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply