Batch Refactoring > Rename Resource

Graham Hannington
Posts: 48
Joined: Mon Jun 13, 2016 11:23 am

Batch Refactoring > Rename Resource

Post by Graham Hannington » Wed Aug 05, 2020 4:38 pm

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.

Radu
Posts: 7399
Joined: Fri Jul 09, 2004 5:18 pm

Re: Batch Refactoring > Rename Resource

Post by Radu » Thu Aug 06, 2020 1:19 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Cosmin Duna
Posts: 32
Joined: Wed Dec 12, 2018 5:33 pm

Re: Batch Refactoring > Rename Resource

Post by Cosmin Duna » Thu Mar 04, 2021 5:53 pm

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
Cosmin Duna
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply