Mapping FrameMaker variables to XML elements
February 25th, 2005 2 Comments
This is just to remind myself how to do this - because it's not spelt out in any documentation I know about and it took me a while to figure it out from the FrameMaker Structure Application Developer's Guide.
On the title verso of my manuals I have a code that tells you the last time the document was modified. I don't want to type this in automatically. Before I started using XML source files this was easy - just use a variable. In an XML-based system it's not so easy because, by default, if you add a variable like Current Date (Long) the date gets written out as text in the XML file - e.g. February 25, 2005. When you open the document up again in FrameMaker, the date is now hard-coded and you need to change it manually.
What you need to do is use a read/write rule to tell FrameMaker that the FrameMaker "Date" element should be a system variable and when it's written to XML it should be called "date". To do this, add this to your rules:
element "date"
{
is fm system variable element "Date";
}
You then need to edit your EDD file to tell FrameMaker which system variable you want to use. Here is what I used in my EDD:

Which looks like this in structure view:
Finally, I had to modify my DTD to specify that this element is an empty element. If you don't do this, the date will get written to the XML file as an opening tag with no closing tag, which obviously causes a validation error when you save the file. What you want is an empty element .
My DTD now contains the following description of a date element:
<!ENTITY % date.element "INCLUDE"> <![%date.element;[ <!ELEMENT date EMPTY> <!--end of date.element-->]]>
This now works nicely. When you add a Date element within a Revision element in FrameMaker, the Modification Date (Long) system variable is automatically added, and this survives round-tripping. I've modified this variable in my template so that it shows up as a code rather than a conventional date. If you enter a Date element elsewhere, you can select an option for the Role attribute value and this gives you one of the other available date variables.
Potentially similar posts
- Scan for available IP addresses – August 2011
- My first (useful) Ruby program – June 2011
- Use the existence of a file on the server to determine Javascript behaviour in the browser – November 2010
- Gotchas with running a Perl script as a cron job – August 2010
- Problems with Flare 2.0 – January 2007

November 19th, 2009 at 6:10 pm (#)
I am trying to use Framemaker to generate an xml document we can scoop into our Flash xml template. I need to learn about what you have on this page: http://www.itauthor.com/2005/02/25/mapping-framemaker-variables-to-xml-elements/.
I cannot see any of the .gif images. Can you help?
Lori
May 19th, 2010 at 2:53 pm (#)
Interesting and helpful. Thank you.