I'm a complete beginner at FrameMaker and scripting of the same, and I've been tasked with converting S1000D documents in XML format into FrameMaker files using an unstructured template.
I've managed to import some XML files into FrameMaker and saved them as .fm files. Now I need to set different paragraph formats on different elements in those files. The paragraph formats are taken from an unstructured document and imported into the files. How can I assign them to the different elements?
I'm currently walking through the elements in the document from mainFlow.HighestLevelElement using the FirstChildElement and NextSiblingElement methods and checking the ElementDef.Name for the tag name, which works, but I've so far been unable to find a way to set a format on the Element. Is it possible? Is there a better way? Any suggestions welcome.
I am sorry but you are taking a completely wrong approach to the problem. Opening an XML file in FM and saving it as an FM file does not make it unstructured and it never will, or should. I understand your problem as follows: you have the XML documents and need to apply the formats from an unstructured FM template to the various elements.
There are two different options I can see for you:
1. Change the EDD for the structured application that is used to import the S100D documents into FM. This is not the easiest job in the world but it can certainly be done. Instead of assigning the formats that happen to be in the template that FrameMaker uses for importing S1000D documents, the EDD would then assign the formats from your unstructured document to the elements. There are various developers on this forum - including myself - who would gladly do this work for a reasonable fee.
2. Open the template that FrameMaker uses to import S1000D documents and adapt the styles in that document to the ones you have in the unstructured template. In this case, the names of the formats in all the paragraphs of the imported document will not change to the names used in your unstructured template but the end result will look the same. This work is tedious and may take quite some time, but it does not require a lot of in-depth knowledge of structured applications and EDDs.
If the formats have to have the names of the styles defined in the unstructured template, option 1 is the only one for you.
Thanks for your quick reply, that's pretty much what I expected to hear. I'll look into option 1 and see if I can make heads or tails of it. Do you have any recommended reading for me if I want to tackle it myself?
Another alternative to consider is using a database publishing tool like Datazone's Miramo to convert the S1000D XML content to the unstructured FM files. It requires a bit of XSLT to map the elements to the Miramo mark-up. This is a technique used by a major manufacturer of the world's fastest trains to publish their S1000D content.
Depending upon your timing and volume requirements, there is a Personal Edition of Miramo available (currently, you'll have to ask, as the MiramoPE site is down) that can be used to prototype and develop solutions, as well as doing production in a desktop (non-server) environment.
You will need the Structure Application Development Guide. Part 3 of that document explains all the EDD rules. The guide can be downloaded from the Adobe site. It does not matter which version of FrameMaker - I am using the guide for version 8 and do not even know if there is a newer one.
The structure applications can be found via StructureTools > Edit Application Definitions. That opens the structapp file in FM. Look for the S1000D application and check the name of the template that is mentioned there, as well as the EDD that is defined.
Find the directory that holds these files, create a copy of it and relink the S1000D app to the new EDD and template. Then open the EDD in FM and edit the assignment of paragraph formats to match your unstructured template styles. Import the EDD into the template and save the template. Test it by importing (opening) an S1000D file. Make changes, import de EDD into the template, import the S1000 file again. Keep doing that until you are satisfied with the result.
That is basically it. If you get stuck or completely overwhelmed, send me a couple of files (s1000D format and the unstructured template) and I will make you a reasonable quote.