Tuesday, 25 November 2008

Generating PDF output with DITA-FMx

(FrameMaker 8, DITA-FMx v1.00.26, DITA 1.0)

The following is a procedure that I have tested and almost perfected over the past couple of months to make a FrameMaker User Guide (and hence a PDF file) from a set of DITA topics originally targeted as online help.

1. I want my User Guide to have a classic "book" structure rather than the Task/Reference/Concept structure of the online help, so I create a separate DITAMAP file specifically for the User Guide. Bear in mind that only top-level topic references in the DITAMAP file will map to chapters in the FrameMaker book.

2. Create a DITAVAL file. Create or register this DITAVAL file with DITA-FMx using the DITA-FMx > Ditaval manager menu option. Create two entries in the DITAVAL file; "print" and "online". For the User Guide, you'll need to set the print action to "include" and the online action to "exclude". For example:

<val>
<prop att="audience" val="print" action="exclude" />
<prop att="audience" val="online" action="include" />
</val>

3. Add any User Guide-specific content to your DITA topic files. For example, I want screen captures to appear in the User Guide but not in the online help, so I add <fig> elements wherever appropriate. Set the audience attribute on the element to "print". Similarly, if you have content specific to the online help that you don't want to appear in the User Guide, set the audience attribute to "online".

4. In the DITA-Fmx options window, set the DITA book application to the appropriate "book generation" application. Your application developer should have set this up for you: basically the Book application is a Structured application registered with FrameMaker that points to all the Template, EDD, and DTD files necessary to generate the book. You can review the available applications with StructureTools > Edit Application Definitions. The value of the ApplicationName element is the name that appears in DITA-Fmx's list of available applications.

5. Choose DITA-FMx > Generate Book from Map. You will probably get a "Validation of XML file failed" message box with a bunch of errors. Ignore these for now.

6. Choose the book name. You will be using a "dummy" book originally, so I generally call it something like "DUMMY.book".

7. When the Book window appears, save it immediately with the "real" name (File > Save book as).

8. Working now with the "real" book, add title page, front matter, and back matter files as necessary. I typically have Titlepage, Preface, TOC, and Index files, for example. Add these in a "nonstructured" way as you would with unstructured FrameMaker.

9. I generally use the Titlepage document to contain all the universal variables that I use in the unstructured files and in the headers and footers of the structured files. For example, I set up ProductName and BookTitle variables. This way, I can easily import the variables into all the unstructured and structured files. More of this later.

At this stage, you'll probably want to do a bout of debugging to set up the "real" book exactly as you want it. For fixes to the structured files, obviously do them in the original DITA topic files and DITAMAP, or they'll get overwritten the next time you re-generate the "dummy" book.

When everything is set up as I want, I proceed as follows whenever I need to re-generate my User Guide:

1. Make the User Guide DITAMAP file the current document.

2. Check that the DITAVAL file is set up with "print=include" and "online="exclude".

3. Choose DITA-FMx > Generate Book From Map. Overwrite the "dummy" book file and confirm overwriting all files.

4. Close the "dummy" book file and open the "real" book file.

5. Open the Title page and import its variables into all other files in the book (File > Import > Formats).

6. Apply the correct Master pages to the generated files in the book (Format > Page Layout > Apply Master Pages).

7. Run DITA-FMx > Apply Ditaval as conditions. This sets all text that is marked as "exclude" in the DITAVAL file as conditional text and hides it.

8. Optionally, turn off Conditional text indicators in each of the generated files (by default, text tagged with the "print" action appears in red).

9. Generate the book (Edit > Update book).

10. When it's what you want, File > Save as PDF and create your PDF file.

I have this second procedure down to about 5 minutes per book now!

The only caveat is that if ever you update your DITAMAP with a new top-level entry that causes a new FrameMaker chapter file to be created, you'll need to remember to manually add the new file to the "real" book.

One other "bug" I have noticed is that if you use the locktitle attribute in your DITAMAP to specify Title text specifically for the User Guide, the navtitle text doesn't get copied to the PDF bookmarks when you generate a PDF file. Hopefully this will get fixed in a future release.

Smart quotes with FrameMaker and DITA-FMx

(FrameMaker 8 with DITA-FMx v1.00.26, DITA 1.0)

If you have Smart Quotes turned on in FrameMaker, beware that double quotes (") typed in FrameMaker are by default translated as `` (&#8220;) and ” (&#8221;) in generated XHTML. Only by turning off Smart Quotes in FrameMaker can I get standard straight quotes " (&#34;) in the XHTML. Of course, I then get straight quotes in my PDF files as well.

The solution is to wrap the text in a <q> (quote) element in DITA.

This has several advantages:
1. The correct opening and closing smart quotes are inserted automatically in FrameMaker.
2. The generated XHTML gets straight quotes.
3. The generated PDF gets smart quotes.
4. When the language attribute is set, the quotes get translated to localized versions, for example
« (&#171;) and » (&#187;) in French.

Friday, 13 June 2008

Viewing XML in Oxygen's browser

I had a problem viewing XML files in the browser configured within Oxygen 9: IE7 wouldn't launch at all.
I fixed is by running:

regsvr32 msxml3.dll

I was then able to open the XML files with IE.

Monday, 10 March 2008

Translating HTML Files with DITA

We've just completed our first translation test with LionBridge.

Overall, very successful, but just a few things to remember:

- The xml-lang attribute must be set in EVERY topic file. It's not enough to set it on the map and expect it to filter down. So for the French files we have for example:

http://dita.oasis-open.org/architecture/2005/">

This causes the DITA-OT to use translated versions of "Related concepts", "Related reference" etc. for link titles.

- Open the HHC, HHK and HHP files in a good text editor (I used Ultraedit) and save them as ASCII/ANSI. This is necessary because the HTMLHelp compiler does not support Unicode. In particular, before converting my HHK file, accented characters in the Index appeared incorrectly.

- I don't know what effect it had specifically, but I set the Language option in the HHP file to French :

Language=0x40c French (France)

You can set this with the Help Workshop:

1. Double-click the Language setting in the [OPTIONS] list.

2. In International Settings, choose the language.

3. Recompile.



Tuesday, 4 September 2007

Switching Frame book applications with DITA+FMx

DITA+FMx does not (yet) include the Build FM DITABook menu option to build a FrameMaker book from a DITAMap. This is apparently due to licensing problems between Abobe and Leximation, the author of DITA+FMx.
However, you can still use the option provided you keep your old DITA+FM plugin installed and follow the instructions described in the DITA+FMx documentation at http://docs.leximation.com/dita-fmx/0.01/

When you generate a Book, an option in the ditafm/DITAfm.ini file controls which structured application FrameMaker calls to perform the generation of FrameMaker files. To switch between different applications, you have to comment out the lines that don't apply. For example:

;DITABOOK-StructApp=DITA-FMx-Book
;DITABOOK-StructApp=DITA-Book-FM
DITABOOK-StructApp=Gemalto-DITA-Book-FM

In this example, the semicolon (;) comments out the first two entries, so the third one is used. If you forget to comment out an application, the first entry is used by FrameMaker. The names of the structured applications are as defined in the structapps.fm file (File > Structure Tools > Edit Application Definitions, then look at the XMLApplication/ApplicationName tag in the structure view).

Thursday, 23 August 2007

Formatting Figure Titles in HTML and CHM

All DITA elements have an outputclass attribute. Set this attribute to a CSS class name that exists in your CSS stylesheet and you have a very simple technique for formatting your HTML-based output. At least, that's what I thought....

I have been inserting a figgroup element after each of my image elements, in order to get the figure title to appear below the image, instead of above it as DITA intends it. Problem was, when I set the outputclass on the title element that is a child element of figgroup, the class attribute wasn't appearing in the HTML output.

After much experimentation, I discovered that the solution is to set the outputclass attribute on the figgroup element itself:
<fig>
<image height="103" width="226" align="center"
placement="break" href = "images/DAEditLayoutwindow.gif" />
<figgroup outputclass = "figtitle">
<title>The Edit Window Layout
Window
</title>
</figgroup>
</fig>

This produces the following HTML output:
<span class="figtitle">The Edit Window Layout
Window</span>

then, in my CSS stylesheet, I added :
.figtitle {
font-weight: bold;
font-style: italic;
font-size: 8pt;
}

Monday, 20 August 2007

Using a DITAVAL file with FM+DITA

For some reason, the conditional processing parameter dita.input.valfile is not recognized by the DITA Open Toolkit when you're using the FM+DITA plugin.
There's a workaround: add the value to the ditafm.ini file in the ditafm folder of your root FrameMaker installation.
The procedure is quite straightforward:
  1. Define the attributes in your topic files that you wish to make conditional (for example, set audience to "internal", product to "XMS Version 1" or platform to "Unix").

  2. Open the ditafm.ini file in a text editor. Find the AntCommand line (in the [BuildFile] section) and add -Ddita.input.valfile="path_to_ditaval_file". For example:
    AntCommand=ant -Ddita.input.valfile="C:/WORK/VMXMSRepository/en-GB/XMS Help System/Common/common.ditaval"
  3. Create a .ditaval file in the specified location. The content is described in the DITA OT documentation. For example:
    <?xml version="1.0"?>
    <val>
    <prop att="product" val="m3" action="exclude" />
    </val>
  4. Restart FrameMaker to take the changes to the ditafm.ini file into account.
Note that this approach has one serious disadvantage: the ditafm.ini file controls all conditional processing, so you can't have several different .ditaval files active simultaneously. Let's hope they address this problem soon.

It's also not yet clear how this works in FrameMaker 8.0, as the aforementioned [BuildFile] section is missing from the ditafm.ini file supplied with FrameMaker 8.0 altogether (btw, it's now in the fminit/ditafm folder).