Is there a way to automate multiple transformations?

Oxygen general issues.
TumasN
Posts: 12
Joined: Sat Jun 24, 2023 7:35 pm

Is there a way to automate multiple transformations?

Post by TumasN »

In my work setup, I currently have 2 (may have more) projects that I switch between and since one is located in the subdirectory of other (so that I can have example.com and example.com/subdirectory as 2 separate projects but both are transformed into the same /out directory as common HTML), I must always run the same transformation scenario (WebHelp) on one project, then switch to the other project, and then click the same button to transform the other project.

Is there any way to automate this process so that I would be able to do one action, and the default transformation would first be done in project1 and then in project2? This would save me from a potential mistake of e.g. forgetting to run the transformation for project2.

Thanks for any suggestions!
Radu
Posts: 9093
Joined: Fri Jul 09, 2004 5:18 pm

Re: Is there a way to automate multiple transformations?

Post by Radu »

Hi,
So you are publishing DITA XML content, correct? And you want to automate the sequential publishing of two or more DITA Maps, correct?
Maybe you could define a DITA OT project which defines contexts and deliverables for each DITA Map and the publish the entire DITA OT project file with its associated transformation scenario:
https://www.oxygenxml.com/doc/versions/ ... oject.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
TumasN
Posts: 12
Joined: Sat Jun 24, 2023 7:35 pm

Re: Is there a way to automate multiple transformations?

Post by TumasN »

Hey, Radu.

Yes, I have DITA content but I'm not publishing just 2 maps. I have 2 completely separate projects.
I tried using 2 maps at the start but then the WebHelp transformation was not configurable individually for each and I had other issues with the menu structure after publishing being conjoined etc.
The output is basically for two completely separate documentation sites for two products.
The reason why I need to run 2 transformations always together, even if I don't do any changes to one of the products is that the output directories on the server are "/" for the first project and "/something/" for the second project. Therefore, both my projects generate the WebHelp output into the same output directory, just a different subdirectory. And since there is a section in the main map with chunk="to-content", the WebHelp generates tons of files with random names every time, so I need to clear the output directory before transformation.

Basically:
- If I just run the first (main) transformation, I get just the "/" website ready and the "/something/" website content is deleted (because the directory is purged in this transformation)
- If I then run the second transformation, it does not purge the directory (was purged with the first one), and it just generates the "/something/" HTML content.

So, I'm looking for a way for two separate *projects* to be automated together as I said, as this cannot be done within a single project.
Radu
Posts: 9093
Joined: Fri Jul 09, 2004 5:18 pm

Re: Is there a way to automate multiple transformations?

Post by Radu »

Hi,
I'm not publishing just 2 maps. I have 2 completely separate projects.
Oxygen WebHelp output can be obtained by opening a DITA Map and publishing it to WebHelp output. So you are probably publishing multiple DITA Maps to WebHelp output. It does not matter in what folder or project they are placed. And a DITA OT Project file can define all your publication requirements for each DITA Map so that when the DITA OT project file is published, it publishes all your defined deliverables.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
TumasN
Posts: 12
Joined: Sat Jun 24, 2023 7:35 pm

Re: Is there a way to automate multiple transformations?

Post by TumasN »

OK thanks Radu I will give it a try. As long as I can have completely different parameters for the WebHelp transformation for each map, that should work then.
Radu
Posts: 9093
Joined: Fri Jul 09, 2004 5:18 pm

Re: Is there a way to automate multiple transformations?

Post by Radu »

Hi,
Right, here are some example DITA OT project files from our projects:
https://github.com/oxygenxml/userguide/ ... roject.xml
https://github.com/oxygenxml/blog/blob/ ... roject.xml
So when you define on a deliverable a transformation type you can use <param> parameters to pass name/value parameters to it, in this case I'm passing a reference to the publishing template folder:

Code: Select all

  <deliverable name="Oxygen XML Blog to WebHelp Responsive" id="wh-responsive">
    <context idref="blog"/>
    <output href="site"/>
    <publication transtype="webhelp-responsive">
      <param name="webhelp.publishing.template" href="publishing/webhelpBlogTemplate"/>
    </publication>
  </deliverable>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
TumasN
Posts: 12
Joined: Sat Jun 24, 2023 7:35 pm

Re: Is there a way to automate multiple transformations?

Post by TumasN »

It works, thank you! If anyone needs to do something similar, here's what I did:
1. I edited both transformations, selected Export, and saved the configured templates next to default templates. One in the main directory, another in the sub-directory.
2. I used the following file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://www.dita-ot.org/project">
  <context name="Main Guide" id="main">
    <input href="main.ditamap"/>
  </context>
  <deliverable name="Main Guide to WebHelp Responsive" id="main-wh">
    <context idref="main"/>
    <output href="../docs"/>
    <publication transtype="webhelp-responsive">
      <param name="webhelp.publishing.template" href="publishing/publishing-template-main.zip"/>
    </publication>
  </deliverable>
  <context name="Sub Guide" id="sub">
    <input href="sub/sub.ditamap"/>
  </context>
  <deliverable name="Sub Guide to WebHelp Responsive" id="sub-wh">
    <context idref="sub"/>
    <output href="../docs/sub"/>
    <publication transtype="webhelp-responsive">
      <param name="webhelp.publishing.template" href="caa/publishing/publishing-template-sub.zip"/>
    </publication>
  </deliverable>
</project>
Note that I publish to /docs, not /out, hence ../docs (default is /out so have to go one level up and then into docs).
When /docs is sent to the server, the guides are available at:
www.example.com - main guide
www.example.com/sub - sub guide
TumasN
Posts: 12
Joined: Sat Jun 24, 2023 7:35 pm

Re: Is there a way to automate multiple transformations?

Post by TumasN »

Radu, just one last question. Is there a way to automatically open both results in the default system browser, like it happens after I run the transformations manually from the projects?
Radu
Posts: 9093
Joined: Fri Jul 09, 2004 5:18 pm

Re: Is there a way to automate multiple transformations?

Post by Radu »

Hi,
A scenario of type "Publish DITA-OT Project (all deliverables)" can be duplicated and in the "Output" tab you can manually specify a single HTML file location to open after the scenario runs, so you cannot specify two or more locations.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply