Variables for document template

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
antoterrence
Posts: 11
Joined: Sat May 04, 2019 5:55 pm

Variables for document template

Post by antoterrence » Fri May 10, 2019 3:12 pm

We have a custom bookmap template that contains references to collections or reusable components. Templates sit in a fixed folder. However, the referenced reusable files are in a variable path. When the user creates a new bookmap using the custom bookmap template, the references are broken. Is there a way to use a variable for the file path?

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

Re: Variables for document template

Post by Radu » Mon May 13, 2019 2:42 pm

Hi,

Inside the DITA Map template's XML content you can use Oxygen editor variables which will be automatically expanded when the end user creates a new file based on the template.
For example you could use something like:
https://www.oxygenxml.com/doc/versions/ ... ables.html

Code: Select all

<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
    <title>ABC</title>
    <topicref href="${makeRelative(${currentFileURL}, ${pdu}/reusables/reusable.dita)}"/>
</map>
But there is a potential problem, when you use File->New to create a new DITA Map based on the new file template there is a "Save as" field with a checkbox next to it. If the checkbox is checked by the end user and they decide the place on disk where to place the DITA Map and its name, then Oxygen will know how to expand the "${currentFileURL}" editor variable. But if the end user unchecks the "Save as" checkbox Oxygen will create an untitled DITA Map and will no longer know how to expand the "${currentFileURL}" editor variable because the end user has chosen not to save it to disk when creating the content from the new file template.
So you would need to instruct the end user to always use the "Save as" field when creating a new DITA Map from the template and specify a location for the newly created DITA Map.

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

antoterrence
Posts: 11
Joined: Sat May 04, 2019 5:55 pm

Re: Variables for document template

Post by antoterrence » Mon May 13, 2019 3:23 pm

Thank you. I got this to work. In some cases, the expanded path is an absolute path and not a relative path. That will cause potential portability issues.

Post Reply