Page 1 of 1

Batch Refactoring > Rename Resource

Posted: Wed Aug 05, 2020 4:38 pm
by Graham Hannington
I want to rename all of the .dita files that a .ditamap refers to. I want Oxygen to automatically change all references, including cross-references, to the old file names to the new file names.

I can do this in Oxygen interactively, one file at a time, using Refactoring > Rename/Move Resource. That's great; very helpful.

Now, what's the easiest/quickest/best way to automate that "Refactoring > Rename/Move Resource" function?

I can prepare a file containing the original and desired file names in any format necessary.

I'm open to writing code. I've written automation macros/scripts for many other applications (e.g. MS Office VBA). I've just never tried custom automation with Oxygen before.

Re: Batch Refactoring > Rename Resource

Posted: Thu Aug 06, 2020 1:19 pm
by Radu
Hi Graham,

I'm afraid we do not have an out of the box solution to batch refactor content based on certain criteria.
Oxygen does have support for plugins (Java based) and for XSLT-based XML refactoring scripts.
There is an example here for renaming file name prefixes in a DITA topic:
https://github.com/oxygenxml/dita-refac ... 20prefixes
in that example first an ANT script is run to rename the files on disk:

https://github.com/oxygenxml/dita-refac ... Topics.xml

and then a custom XSLT refactoring script is performed on each topic to rename the references (in conrefs and xrefs):

https://github.com/oxygenxml/dita-refac ... efixes.xsl

More about custom XML refactoring actions in Oxygen:
https://www.oxygenxml.com/doc/versions/ ... tools.html

Regards,
Radu

Re: Batch Refactoring > Rename Resource

Posted: Thu Mar 04, 2021 5:53 pm
by Cosmin Duna
Hello,

I just wanted to let you know that Oxygen 23.1 is out now and it contains a new script for running XML refactoring operations. See the following link for more information: https://www.oxygenxml.com/doc/versions/ ... oring.html

Best regards,
Cosmin