XML import result file type changes when I add XSLT pre-processing
Copy link to clipboard
Copied
Hi all,
I am trying to import a customized docbook into FrameMaker.
I set up structured application, read-write-rules, EDD succesfully.
When I open the XML, it asks for the structured app. to use, and opens as a single .xml file.
But I discovered I have to do some XSLT pre-processing, to convert the content of an element to attribute of the parent element. I wrote the xsl conversion, and added it to the structured application for PreProcessing.
But now there is no question for the structured app. to use, XML opens as an .fm project, splitting each chapter to a different book, and converting my element names to CamelCase.
Why is this change happening? Maybe the DOCTYPE is lost in XSLT?
Where can I investigate the intermediate xml created after the XSLT pre-processing?
Copy link to clipboard
Copied
Baksa,
When you open an XML document, FM attempts to determine the application to use from the name of the root element. There are three possibilities:
1) The root element is not listed as a DOCTYPE in any of the currently defined applications. In this case, FM must prompt for the name of the application to use, allowing you to select any defined application.
2) The root element is listed as a DOCTYPE in one and only one application. In this case, FM uses that application without prompting.
3) The root element is listed as a DOCTYPE in multiple applications. In this case, FM prompts for you to choose one of the applications that list the root element as a DOCTYPE.
If FM used to prompt for an application, but no longer does, then it is likely that your previous version of structapps.fm (or whatever application definition file you are using) defined multiple applications that have DOCTYPE elements listing the root of your XML document as a DOCTYPE, but the current version of structapps.fm does not.
The two most common ways of creating a book from an XML document are:
1) Include appropriate processing instructions in the XML document.
2) Use read/write rules that specify which root elements should map to a book and which elements within them should create new documents within the book.
Note: the xdocbook application that is part of FrameMaker uses the second method.
Read/write rules can specify that element names differ in XML and in structured documents. In particular, xdocbook maps XML element names from all lowercase to camel case.
Given your comments about the unexpected lack of a prompt for an XML application, element name changes, and use of books, I wonder if you are now using xdocbook unintentionally. Have you changed the root element of your XML document? Are you modifying the definition of xdocbook in your structapps.fm or defining your own application? If the latter, make sure to add appropriate DOCTYPE elements to the application definition to avoid automatic selection of xdocbook.
FM stores the result of an XSLT preprocess in %temp% and deletes it when it is no longer needed. If opening the temporary file causes FM to create a book, FM prompts for the filename of the book. You can look in %temp% after the prompt appears and before you dismiss it. Otherwise, you can run the XSLT transform yourself (in FM's code view or with some other XSLT processor) to confirm that the XSLT result is what you expect.
--Lynne
Copy link to clipboard
Copied
(I had prompt to select XML application because multiple versions of my application used the same DOCTYPE).
Yes, it looks like when I add the PreProcessing element to my structured application, it gets read as XDocBook. I didn't find any usable data in %temp%. Maybe there is an error in the .xsl file, FM skips my structured application, and falls back to XDocBook?
I will try running the XSLT manually.
Copy link to clipboard
Copied
Baksa,
Which version of FM are you using? You might check the console to see if there are relevant messages. Also, make sure your copy of FM is fully updated.
FM selects the application before running XSLT. After all, it's the application that defines the preprocess. Therefore, XSLT errors should not cause it to choose a different application. You can confirm that FM is running the XSLT transform you want by renaming the XSLT file. If FM cannot find it, it cannot run it, and will complain. If it doesn't, something is wrong in your configuration.
In your position, I would solve the problem of which application FM is using before looking into the XSLT results.
Good luck,
--Lynne
Copy link to clipboard
Copied
I found the problem: in maker.ini I entered the line TreatXMLAsXML=Off because the documentation mentioned it somewhere, and I was checking what it does. I didn't assume that Off is enforced.

