Prepare Variables

Saves variable names to attribute values so they can be rebuilt after the map to book conversion.

FrameMaker variables are saved to XML as entities, and will round-trip fine in and out of Frame (as long as they are named properly). However, any variables that are processed by the Generate Book from Map command are flattened (converted to text) because entities do not survive XSLT processing. This command was developed as a way to work around this limitation.

Before running the Generate Book from Map command, run the Prepare Variables command on all files that contain FrameMaker variables. This wraps each variable in a ph element and assigns the variable name to the keyref attribute using the format “fmvar:VARNAME” (where VARNAME is the name of the variable). After conversion to a book and chapter files, you can run the Rebuild Variables command to rebuild live variables from the data stored in the ph elements.

You can run the Prepare Variables command individually on each DITA file, or you can use the Build Workbook from Map command to create a “workbook” from which you can process all of the files at once. Before running the Prepare Variables command on the workbook, you must first open all of the files with the Open All XML Files in Book command.

It is fine to run this command multiple times on the same files or variables, so you may just want to run the command after entering a variable or before saving a file.

Important: If you use the Prepare Variables command and feel inclined to set attributes on the ph elements that wrap the variables, don’t do it. The ph wrappers are temporary and are deleted each time the command is run. If you want to apply filtering or other attributes to variables, wrap them in a ph element and apply the attributes on that element.

The DITA-FMx Options dialog offers the Auto Prepare Variables on Save option. If this option is enabled, the Prepare Variables command is run each time you save the document. This may allow you to skip running this command on a workbook before generating the final book file.