Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Handling multiple PCF profiling files


Handling multiple PCF profiling files

I have a feeling that I'm missing something regarding handling PCF files for profiling.

We have many document sets that are created in DocBook and DITA, where each document set has
different profiling requirements.

As far as I can see, the PCF file that defines the valid profiling values has to be
in /custom/doctypes/axdocbook or /custom/doctypes/ditabase (or in some other fixed location defined
in the DCF file).

Currently we swap out the PCF file under /custom/doctypes/ according to the document set that we are
working with.

This is cumbersome. Have I missed something basic here? Just for example, I would have expected
that a PCF in the same folder as the XML file would be used in preference to the PCF file
under /custom/doctypes but that does not appear to be the case.

Any suggestions?

Kongsberg Maritime

Hi Martin--

You can switch PCF files, out, but the way you do it is a bit indirect.
To make this work, you need to define a function that loads the PCF file
you want to use and returns the ACL doc ID for that PCF document, then
attach that function as a profiledochook, something like this:

function load_profile(doc = current_doc()) {

# doc_open flags: readonly, no warnings/errors, no stylesheet, don't
prompt for doctype

local FLAGS = 0x001 | 0x020 | 0x200 | 0x400;

# check for PCF file in doc directory

local docdir = doc_dir(doc);

local pcfs[];

glob(docdir . $main::PCS . "*.pcf", pcfs);

if (count(pcfs)>0) {

# found one, so let's use it

local pcfdoc = doc_open(pcfs[1], FLAGS);

return pcfdoc;


else {

# no special file found, so just load default doctype PCF

return 0;



# add hook function



Clay Helberg

Senior Consultant


And that method works like a charm.

Thanks a lot Clay!


You're welcome, glad it worked for you.


Sent from my iPad

Top Tags