Relative path for conref in templates

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
Posts: 12
Joined: Sat May 30, 2015 2:18 am

Relative path for conref in templates

Post by JulieP » Thu Jul 25, 2019 1:36 am

Our templates are in a /doc/resource/templates folder. We want to include conrefs in the template that won't break no matter where we create files with the template. For example, we typically create files under a /doc/source/product folder and we want to conref text in a /doc/source/common folder.

How can we make this work with the ${makeRelative(base,location)} variable? I've tried using ${currentFileURL} as base with a variety of other variables as location but I can't get this to work. What exactly is base and what is location? Is there something else that I should be doing?

Posts: 7538
Joined: Fri Jul 09, 2004 5:18 pm

Re: Relative path for conref in templates

Post by Radu » Thu Jul 25, 2019 9:39 am

Hi Julie,

Usually in such cases as you are using DITA I would suggest you use conkeyrefs instead of conrefs, this would ensure you do not have file path dependent references in your new file templates.

But indeed using the "makeRelative" is another option. The first parameter is the URL path to the current created file template, so it should be "${currentFileURL}". The second parameter should be the URL path to the file containing the reusable content, so it should be something like "${pdu}/reusables/reusable.dita#topicID/elementID".
If you create the new file based on the template using the "File->New" wizard dialog, at the bottom of the dialog there is a "Save as" field. You need to check that and decide on a location for the newly created file, otherwise the "${currentFileURL}" will not be properly expanded as the newly created file is not yet saved on disk.
If this will not work for you I will try to create a sample project on my side and send it over.

Radu Coravu
<oXygen/> XML Editor

Post Reply