Batch Refactoring > Rename Resource

Post here questions and problems related to editing and publishing DITA content.
Graham Hannington
Posts: 48
Joined: Mon Jun 13, 2016 11:23 am

Batch Refactoring > Rename Resource

Post 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.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Batch Refactoring > Rename Resource

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Cosmin Duna
Site Admin
Posts: 120
Joined: Wed Dec 12, 2018 5:33 pm

Re: Batch Refactoring > Rename Resource

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