Output filename based on variables

AndrewCampbell
Posts: 3
Joined: Tue Jul 16, 2019 5:17 pm

Output filename based on variables

Post by AndrewCampbell » Thu Jul 25, 2019 5:45 pm

I'd like to be able to set the output base filename (the part specified by args.output.base) based on the value of some variables.

In my case, the mainbooktitle in each of my bookmaps consists of three ph elements which are in turn keyref'ed, something like this:

Code: Select all

<mainbooktitle>
        <ph keyref="Product"/> 
        <ph keyref="Release"/>
        <ph keyref="DocumentType/>
</mainbooktitle>
I would like the output filename to be something like "[value of Product]_[value of Release]_[value of DocumentType].pdf".

I can think of a few complex ways of making this happen by wrapping the DITA-OT in a shell script or something similar, but I'd prefer to do it as a regular plugin, especially as I could use a regular plugin within Oxygen. Is this possible?

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

Re: Output filename based on variables

Post by Radu » Fri Jul 26, 2019 8:26 am

Hi Andrew,

I see you already got some answers on the DITA Users List.
I do not have a clear idea how a plugin could do that, probably if the plugin would have some custom ANT target which would be called before the PDF is produced, it could call an XSLT script to process the DITA Map from the temporary files folder (which would already have the keyrefs expanded). Then it would use the result produced by the XSLT script to set the value of the "args.output.base" parameter in the ANT build file.

Another Oxygen-specific approach would be to edit the transformation scenario and in the "Parameters" tab set a value for the "args.output.base" parameter using Oxygen specific editor variables like "${xpath_eval(expression)} ":

https://www.oxygenxml.com/doc/versions/ ... bles.htmle

and try to use XPath to read the value for each key from the DITA Map where it is defined. But this would work only inside Oxygen.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply