Using XPath with reusable content

Posts: 156
Joined: Tue Mar 06, 2018 1:34 am

Using XPath with reusable content

Post by mdslup » Thu Sep 24, 2020 12:46 am

I am developing a set of procedures that all have unique names and ID codes.

I want to create a "master list" of procedure names and ID codes. My first thought was to use raw XML, like this:

Code: Select all

		<procedure-name>Remove Component 1</procedure-name>
		<procedure-name>Remove Component 2</procedure-name>
Now, when I create each task file, I want the title of each task to pull from this XML document. I would use XPath to do this.

But I don't understand where I tell Oxygen to use XPath to pull content from another reference.

Am I thinking about this correctly? Is there a better way to do this, like is this what a "key map" is?

Posts: 799
Joined: Wed Nov 16, 2005 11:11 am

Re: Using XPath with reusable content

Post by alex_jitianu » Thu Sep 24, 2020 12:13 pm


You can create Document Templates that use the ${xpath_eval(expression)} editor variable to extract the data from the file and further process it as needed. To access the "master list" file you ca:
- use the ${pdu} editor variable, if you are using Oxygen project files and the master file is somewhere in the project directory.
- add a mapping in a catalog file (perhaps the catalog from a framework) between a generic URL and the location of the file. In the XPath expression you use the generic URL.

To avoid duplicating that ${xpath_eval(expression)} in every document template, you can create a custom editor variable that maps to that long ${xpath_eval(expression)}, like an alias. Afterwards, in the document templates, you can use the custom editor variable which is shorter.

By the way, which XML vocabulary are you using? Is it DITA or a proprietary one?

Best regards,

Post Reply