project files param to PATH environment variable

aaron
Posts: 8
Joined: Fri May 22, 2020 6:44 pm

project files param to PATH environment variable

Post by aaron » Wed Oct 28, 2020 4:44 pm

In a properties file, if I want to reference an .exe in the PATH environment variable all I need to do give the exe file name, e.g.:

Code: Select all

css.processor.path.antenna-house = AHFcmd.exe
But how do I do this with a parameter in an XML project file? Using AHFcmd.exe with both href and path tries to find the exe in the current directory and using ${env.PATH} returns a syntax error.

Would it work better in YAML or JSON?

julien_lacour
Posts: 184
Joined: Wed Oct 16, 2019 3:47 pm

Re: project files param to PATH environment variable

Post by julien_lacour » Fri Oct 30, 2020 5:54 pm

Hello,

What do you mean by "in a property file"? I don't understand what is your goal here.

I assume you want to use the "DITA Map PDF - based on HTML5 & CSS" transformation in Oxygen.
If you want to use Antenna House using a variable, you may define a separate variable (for example 'AH_PATH') which value is the path to the AHCmd.exe file.
After, inside Oxygen open the transformation scenario and set the following values:

Code: Select all

css.processor.type = antenna-house
css.processor.path.antenna-house = ${env(AH_PATH)}
If you check inside your '.xpr' file this corresponds to

Code: Select all

...
<ditaScenario>
    ...
    <field name="ditaParams">
        <list>
            <ditaParameter>
                <field name="name">
                    <String>css.processor.path.antenna-house</String>
                </field>
                <field name="description">
                    <null/>
                </field>
                <field name="value">
                    <String>${env(AH_PATH)}</String>
                </field>
            </ditaParameter>
            ...
        </list>
    </field>
    ...
</ditaScenario>
...
If this is not what you expect, please add details to your use-case and indicate which version of Oxygen you are using and which transformation you want to achieve.

Regards,
Julien

aaron
Posts: 8
Joined: Fri May 22, 2020 6:44 pm

Re: project files param to PATH environment variable

Post by aaron » Tue Nov 10, 2020 3:22 pm

Hello Julien,

In the DITA OT I can use several types of file for configuring an output; properties (.properties), project (.xml, not .xpr) and publishing template (.opt)

In a properties file I can simply use "AHFCmd.exe" as the OT checks the PATH environment variable.
But this wasn't working with OT project files and any environment variable syntax I was trying was not working.
I am not using OT project files any more but would assume the syntax you have provide will also work with them. E.g.:

Code: Select all

<project xmlns="https://www.dita-ot.org/project">
<context name="User's Guide Filtered" id="ug_filtered">
    <input href="userguide.ditamap"/>
    <profile>
      <ditaval href="filter.ditaval"/>
    </profile>
  </context>
  
  <deliverable name="User's Guide to HTML5" id="ug_html5">
    <context idref="ug_filtered"/>
    <output href="./html5-output"/>
    <publication transtype="pdf-css-html5">
      <param name="css.processor.path.antenna-house" path="${env(AH_PATH)}"/>
    </publication>
  </deliverable>
</project>


julien_lacour
Posts: 184
Joined: Wed Oct 16, 2019 3:47 pm

Re: project files param to PATH environment variable

Post by julien_lacour » Tue Nov 10, 2020 5:53 pm

Hello,

You can use the PATH environment variable together with the DITA-OT Project file (.xml) following these steps:
  1. Update your PATH environment variable and add Antenna House folder (something like "C:\Program Files\Antenna House\AHFormatterV70")
  2. Add in your XML file the following deliverable:

    Code: Select all

      <deliverable name="User's Guide to HTML5" id="ug_html5">
        <context idref="ug_filtered"/>
        <output href="./html5-output"/>
        <publication transtype="pdf-css-html5">
          <param name="css.processor.type" value="antenna-house"/>
        </publication>
      </deliverable>
    
The 'pdf-css-html5' automatically searches for the AHFCmd.exe file by just setting the processor type.

Regards,
Julien

julien_lacour
Posts: 184
Joined: Wed Oct 16, 2019 3:47 pm

Re: project files param to PATH environment variable

Post by julien_lacour » Wed Nov 11, 2020 11:59 am

Hello,

Another solution is to add the parameter in the command line:

Code: Select all

dita -f pdf-css-html5 -i custom.ditamap -o .\out\pdf-css-html5 -Dcss.processor.type="antenna-house"
Regards,
Julien

Post Reply