Page 1 of 1

Batch search & replace

Posted: Mon Jun 24, 2019 3:09 pm
by davdup
Hi!
Is there a way to make batch search and replace actions, based on a txt or other input file, on a complete DITA map hierarchy? I already found the powerful search/replace tool over a DITA hierarchy, but it can only do one search at a time, and I would have hundreds to do in my conversion process...
Perhaps there is another way using refactoring or XSLT methods...
Basically I would like to convert

Code: Select all

<term id="PLEM">PLEM</term>
<term id="FLET">FLET</term>
<term id="PLET">PLET</term>
...
into

Code: Select all

<abbreviated-form  keyref="PLEM"/>
<abbreviated-form  keyref="FLET"/>
<abbreviated-form  keyref="PLET"/>
...
for hundreds of terms, over all my DITA map hierarchy.
Thanks for the help!

David

Re: Batch search & replace

Posted: Tue Jun 25, 2019 7:48 am
by Radu
Hi David,

Oxygen has support for XML refactoring based on applying a custom XQuery update or XSLT script:

https://www.oxygenxml.com/doc/versions/ ... tools.html

I created a sample XSLT refactor script based on what you described:

https://github.com/oxygenxml/dita-refac ... ated-forms

Basically if you have somewhere on your disk a folder containing the custom operation XML and XSLT documents, then in the Oxygen Preferences->"XML / XML Refactoring" page you point to that folder, then from the main "Tools" menu you can access the "XML Refactoring" action and it should contain a "Convert terms to abbreviated forms" action which can be applied on multiple files.

Regards,
Radu

Re: Batch search & replace

Posted: Tue Jun 25, 2019 10:03 am
by davdup
Fantastic!
I should really go further into XSLT and try to do it myself! I cloned your example repository, and will probably find some more very useful stuff in there! :)
Thanks you made my day.

David