Skip to main content
1-Visitor
September 30, 2012
Question

Handling multiple PCF profiling files

  • September 30, 2012
  • 3 replies
  • 1068 views


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?

Martin
Kongsberg Maritime
www.km.kongsberg.com

    3 replies

    18-Opal
    September 30, 2012
    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

    add_hook("profiledochook","prof_config::profile_doc_loader");



    --Clay



    Clay Helberg

    Senior Consultant

    TerraXML


    mbushby1-VisitorAuthor
    1-Visitor
    October 1, 2012


    And that method works like a charm.

    Thanks a lot Clay!

    Martin





    18-Opal
    October 1, 2012
    You're welcome, glad it worked for you.

    --Clay

    Sent from my iPad