Page 1 of 1

Can a Custom Refactoring Operation Use Saxon's EXPath Extensions?

Posted: Fri Oct 18, 2024 9:25 pm
by dreifsnider
Hi,

I'm looking into creating a new custom refactoring operation for my team that would ideally rename DITA files and then update the references to these files in <topicref> and <xref> elements.

I found that Saxon supports using EXPath extensions which would provide support for "renaming" files (this would probably be a move function) through the file module: https://www.saxonica.com/html/documenta ... xpath.html

I'm wondering though if Oxygen's refactoring engine uses Saxon to process the XSLT and if I can use the EXPath extensions in a custom refactoring operation?

I'm also open to any other ideas you might have for how a refactoring operation could rename DITA files and then update all references.

The reason I'm investigating a refactoring operation is because we have over 500+ files that we would like to rename and we want to avoid having to rename them individually.

Thank you!

Re: Can a Custom Refactoring Operation Use Saxon's EXPath Extensions?

Posted: Mon Oct 21, 2024 7:07 am
by Radu
Hi,
Oxygen in general has support to update links when you rename individual files or when you rename folders if the "Main Files" support is enabled in the project but I assume you already know about this:
https://www.oxygenxml.com/doc/versions/ ... files.html

With the XML refactoring XSLT support you can only make changes inside files, so there is no support to rename files. I assume this means you can try to come up with a hybrid solution, use custom code to rename the files and maybe an XML refactoring XSLT operation to fix up links.
Like for example in this case I used a combination of Ant build files and XML refactoring to convert image href to keyref:
https://blog.oxygenxml.com/topics/repla ... eyref.html
Or use some scripting language all the way to both rename and make changes in files like I attempted here using Python: https://blog.oxygenxml.com/topics/use-t ... names.html

Regards,
Radu