Editor variable in Publishing Template path does not work

Post here questions and problems related to editing and publishing DITA content.
Frank Ralf
Posts: 466
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Editor variable in Publishing Template path does not work

Post by Frank Ralf »

Hi,

I have created a DITA framework extension with Oxygen 26.1 and want to add a WebHelp transformation scenario that uses a custom Publishing Template. The template is stored in a subfolder of the framework folder.

I have tried to reference the Publishing Template by using an editor variable but that does not work:
${frameworkDir}/webhelp/my-webhelp.zip

Using the same syntax for integrating an Author CSS file does work:
${frameworkDir}/css/my-layout.css

Am I missing something?

Best regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
Frank Ralf
Posts: 466
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: Editor variable in Publishing Template path does not work

Post by Frank Ralf »

I found a hint at WebHelp Responsive: How to add a favicon with a relative file path? to specify the type="filePath" attribute for file path parameters in Publishing Templates. Could this be related to my issue?
Frank Ralf
parson AG
www.parson-europe.com
julien_lacour
Posts: 528
Joined: Wed Oct 16, 2019 3:47 pm

Re: Editor variable in Publishing Template path does not work

Post by julien_lacour »

Hi Frank,

The type="filePath" attribute is for publishing templates only, not for frameworks extensions.

To create an additional WebHelp transformation scenario I did the following steps:
  1. Create a ditamap-custom directory in OXYGEN_INSTALL_DIR\frameworks\dita
  2. Create a custom scenario called "DITA Map WebHelp Responsive - Custom" in Oxygen and set your publishing template via the Templates tab
  3. Export the scenario in a custom.scenarios file:
    • In Oxygen, in the Configure Transformation Scenario(s) dialog click on the new scenario
    • Right click to open the contextual menu, then select Export selected scenarios
  4. Copy the scenario into the OXYGEN_INSTALL_DIR\frameworks\dita\ditamap-custom directory together with the my-webhelp.zip template
  5. Edit the custom.scenarios file to change the my-webhelp.zip template path:

    Code: Select all

    <field name="publishingTemplateDataPO">
    	<publishingTemplate>
    		<field name="templateRoot">
    			<String>${frameworksDir}\dita\ditamap-custom\my-webhelp.zip</String>
    		</field>
    		...
    	</publishingTemplate>
    </field>
    
  6. Create an Extend Framework Script file in Oxygen with the following content:

    Code: Select all

    <?xml version="1.0" encoding="UTF-8"?>
    <script xmlns="http://www.oxygenxml.com/ns/framework/extend"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.oxygenxml.com/ns/framework/extend http://www.oxygenxml.com/ns/framework/extend/frameworkExtensionScript.xsd"
      base="DITA Map">
      <name>DITA Map Custom</name>
      <description>Darwin Information Typing Architecture</description>
      <priority>Normal</priority>
      
      <transformationScenarios>
        <addScenarios href="ditamap-custom/custom.scenarios"/>
      </transformationScenarios>
    </script>
    
  7. Save the file in the OXYGEN_INSTALL_DIR\frameworks\dita directory and restart Oxygen. Now you have a new scenario in the DITA Maps Manager Configure Transformation Scenario(s) dialog called DITA Map WebHelp Responsive - Custom
  8. Launch the scenario, the template is applied on the output
Note: If you use an additional framework directory you can update the paths accordingly.

Regards,
Julien
julien_lacour
Posts: 528
Joined: Wed Oct 16, 2019 3:47 pm

Re: Editor variable in Publishing Template path does not work

Post by julien_lacour »

If this is not what you are trying to achieve, could you give us more information or even the files you are using?

Regards,
Julien
Frank Ralf
Posts: 466
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: Editor variable in Publishing Template path does not work

Post by Frank Ralf »

Hi Julien,

Thanks for your reply. I will try your suggestion and report back.

Best regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
Frank Ralf
Posts: 466
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: Editor variable in Publishing Template path does not work

Post by Frank Ralf »

Hi Julien,

Your pointer helped me to solve my problem: I changed the path to the publishing template directly in the .framework file from an absolute path to one that uses the editor variable.

However, when editing the framework extension from the Oxygen GUI (Options > Preferences > Document Type Association: Edit > Transformation tab) I get an error message that the template could not be loaded. Seems like the GUI does not resolve the editor variable. That is probably also the reason I could not set a path with the editor variable from the GUI via the "Choose Custom Publishing Template" link, even it the GUI provides a number of editor variables to choose. Could this be a bug?

Kind regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
julien_lacour
Posts: 528
Joined: Wed Oct 16, 2019 3:47 pm

Re: Editor variable in Publishing Template path does not work

Post by julien_lacour »

Hi Frank,

From what I tested in <oXygen/> XML Editor 26.1, build 2024031806, if the template is inside OXYGEN_INSTALL_DIR\frameworks, the ${frameworksDir} variable expands correctly and the template is displayed in the dialog. Could you confirm this work on your case too?

However, if the template is located in an additional frameworks directory, the variable did not expand and the template isn't displayed.
But as explained in the user guide, the ${frameworksDir} variable points towards the "frameworks" directory only.

Instead you can use this variable: ${frameworkDir(DITA Map Custom)}\ditamap-custom\my-webhelp.zip
Of course you can set this value in the custom.scenarios file too.

Regards,
Julien
Frank Ralf
Posts: 466
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: Editor variable in Publishing Template path does not work

Post by Frank Ralf »

Hi Julien,

Thanks for testing. I sent an e-mail with more details and screenshots to the Oxygen support.

Best regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
Frank Ralf
Posts: 466
Joined: Thu Jan 23, 2014 2:29 pm
Location: Hamburg
Contact:

Re: Editor variable in Publishing Template path does not work

Post by Frank Ralf »

Hi,

I now explicitly state the framework name in the editor variable which works: ${frameworkDir(My DITA)}. The log file shows that the publishing template is loaded correctly:

Code: Select all

whr-init-publishing-template:
Started from a standalone Oxygen installation having maintenance pack up to 2024/05/17.
[templatetask] Loading publishing template from descriptor: I:\path\to\my-webhelp
However, I also get a number of the following warnings in the log file:

Code: Select all

 
 [gen-list] [WARN] Invalid field : webhelpResponsiveTemplate for class ro.sync.exml.editor.xmleditor.transform.dita.DITAScenario. ro.sync.options.r: Field webhelpResponsiveTemplate from instance : class ro.sync.exml.editor.xmleditor.transform.dita.DITAScenario cannot be found.
 
Am I still missing something?

Best regards,
Frank
Frank Ralf
parson AG
www.parson-europe.com
julien_lacour
Posts: 528
Joined: Wed Oct 16, 2019 3:47 pm

Re: Editor variable in Publishing Template path does not work

Post by julien_lacour »

Hi Frank,

I followed the steps from the previous post except that I set the following path to my-webhelp.zip:

Code: Select all

<field name="publishingTemplateDataPO">
	<publishingTemplate>
		<field name="templateRoot">
			<String>${frameworkDir(DITA Map Custom)}\ditamap-custom\my-webhelp.zip</String>
		</field>
		<field name="descriptorRelativePath">
			<String>styles.opt</String>
		</field>
		<field name="isCustomTemplate">
			<Boolean>true</Boolean>
		</field>
	</publishingTemplate>
</field>
As you can see I used ${frameworkDir(DITA Map Custom)} where "DITA Map Custom" is the framework name in the .exf file.

I have a few questions to make sure we have the same setup:
Are you working in Oxygen or are you using an external Oxygen Publishing Engine?
Is your framework available in Options > Preferences... under Document Type Association?

Regards,
Julien
Post Reply