How to handle FrameMaker variables in header and footer while migrating to DITA

Post here questions and problems related to editing and publishing DITA content.
arpitkap
Posts: 1
Joined: Wed Feb 09, 2022 2:55 pm

How to handle FrameMaker variables in header and footer while migrating to DITA

Post by arpitkap »

My current unstructured FrameMaker documents contain variables (both user and system type) in the header and footer. I need to migrate my document into DITA format. While doing so I am struggling to handle these variables. Since DITA does not support the insertion of any element in page header and footer, I am not able to use the DITAVAL feature also in header and footer.
Is this achievable in Oxygen XML interface. If yes, please suggest a work around to have these variable in the DITA interface and also obtain the same during PDF generation.
image.png
image.png
You do not have the required permissions to view the files attached to this post.
chrispitude
Posts: 922
Joined: Thu May 02, 2019 2:32 pm

Re: How to handle FrameMaker variables in header and footer while migrating to DITA

Post by chrispitude »

If you are using PDF Chemistry, you can do this in two steps.

First, create a map-level metaentry that "instantiates" (uses) your variable. For example,

Code: Select all

<map>
    <title>My Map</title>

    <topicmeta>
        <data keyref="Product"/>
    </topicmeta>
    
    <keydef keys="Product">
        <topicmeta>
            <keywords>
                <keyword>Put Product Name Here</keyword>
            </keywords>
        </topicmeta>
    </keydef>
This metadata definition causes the variable value to propagate into the final merged HTML that PDF Chemistry uses for PDF publishing:

Code: Select all

<div keyref="Product" class="- topic/data data - topic/data data">
  <div class="- topic/keyword keyword - topic/keyword keyword">Put Product Name Here</div>
</div>
Then in in your CSS, define a header or footer that references that propagated value using an XPath:

Code: Select all

@page {
    @top-left {
      content: "User Guide for " oxy_xpath('string-join((//div[@keyref = "Product"])[1])');
    }
}
(The reason for the string-join() is that if your key definition value has element structure inside it, you want to collapse everything down to plaintext.)

You can also use profiling conditions inside the variable definition as needed, and those will be reflected in the header/footer.

I am attaching a .zip file with an example Oxygen project that does this; just run the "PDF With Variable in Header" transformation defined in the project.


Testcase:
pdf_chemistry_variable_in_header.zip
You do not have the required permissions to view the files attached to this post.
Post Reply