We want to put our document title in the footer. I did it by editing the FM template to include an empty DocTitle variable, and importing a DocTitle variable from another file into the book after map-to-book.
This works well. But is there a way to accomplish something similar that doesn't require post-processing after map-to-book?
Currently, the only mention of the document title is in the title attribute of the map element in the ditamap file. Any suggestions on how to automatically pull the document title from the map attribute into the structured FM template for footer use?
If it requires much coding, it may be easier to continue the manual import. But I wanted to check in case there's a simple solution. Any thoughts?
I do not use DITA, but I do use structured documents and books. In structured books, one can pull in an attribute from an element as a running header or footer.
I am assuming that after you convert the map to a book, the attribute that holds the document title is in some element in the book. If so, you edit one of the running header/footer variables with the following:
If on the other hand, the title is the content of an element, use the following:
You mentioned: "I am assuming that after you convert the map to a book, the attribute that holds the document title is in some element in the book."
I think that might be the issue. The attribute I need doesn't end up in the book after the map-to-book process.
Looks like I need to use the variable import method, or put the title into a topic attribute that survives the map-to-book process. I'll probably stay with the variable method, as the other would be tough to manage since topics are used in multiple documents.
When you create the book from the map, select the book window and open the structure view. Does the structure view have a root element and possibly some child elements that are NOT the document root elements? If so, and I think it should be, then it seems that one of those elements should have the attribute you want. Again, just guessing because that is the way it is in structured books.
The root element of the book is "fm-ditabook", with two attributes (href and format). Child "fm-ditafile" elements represent each generated FM file, and they also have two attributes (href and format).
In the ditamap, the root element is "map" and the attribute of interest is "title". This element and attribute are not carried forward during the map-to-book process.
If the map-to-book function could be modified to create and populate a title attribute in the "fm-ditabook" element (based on the ditamap "map" title attribute), I think the running header/footer variable could then access it. But I'm not sure how to modify that map-to-book function. It may require editing the XSL.
The map-to-book process basically works like this ..
- select command from menu
- specify output book name
- map is opened with the Book application, which runs the XSLT import script to aggregate the separate XML topic files into chapter files
- after book has been built, a process runs over the book to relink the references
Note that this assumes that you select the command from the menu rather than opening the map with the Book app .. which may seem to work, but does not properly relink the references in the generated FM files.
So, yes .. if you make tweaks to the XSLT, you should be able to get your additional attributes onto the fm-ditabook element.
Got it. Thanks Van and Scott! Here's a summary in case anyone is interested:<br /><br />1. Edited the dita-book-fm.dtd to add support for a "doctitle" attribute in the fm-ditabook element.<br /><br />2. Made the same edit to the book.edd.fm, and imported definitions into the structured template.<br /><br />3. Edited ditamap2fmbook.xsl to include: <xsl:attribute name="doctitle"><xsl:value-of select="@title"/></xsl:attribute> in the <fm-ditabook> area.<br /><br />4. Entered a title attribute in the ditamap map element.<br /><br />5. Built the book and the fm-ditabook doctitle attribute contains the correct title from the map, which can now be used in running headers/footers.<br /><br />Seems to work well so far. Thanks again.<br /><br />Larry
That's great! This is probably something that others will want to do as well. If you can take a moment and add this to the DITA/FrameMaker Community KB, then it will be preserved for easy access by others ..