Adjusting file names in map-first pre-processing
To dynamically adjust the names and locations of output files in the map-first pre-processing routine (preprocess2), you can create a custom plug-in and specify the code that contains your custom rewrite rules.
For example, set the result.rewrite-rule.xsl parameter to specify a bundled XSLT stylesheet that contains your custom rewrite rules.
Your plug-in would also include a custom-rules.xsl file, which might contain templates like this to move all image files to an images subdirectory:
Note: If your rewrite rules are contained in a Java class, you can set the result.rewrite-rule.class parameter instead, and pass the name of your Java class in the @value attribute. The custom class should implement the org.dita.dost.module.RewriteRule interface.