I’ve been working on a way to export XML from that’s compatible with an InDesign workflow. You can download my initial solution from the widget.

This is basically a transform that allows you to save a flat XML document. It works only if you have correctly styled all of your content using paragraph and character styles with the same name as the ones in an InDesign document or template.

Use my PStyles2XMLTags applescript (also in the widget). This will create XML tags with name values equal to your paragraph styles, plus deleting any illegal characters. I would create a separate document with all of my paragraph and character styles applied, then copy all the text and paste into an Writer document. Your ID p- and c-styles will show up in Writer’s Custom Styles panel. (Man, there’s a lot of prep in XML workflows.) Then you can use those styles to style your document.

In with a document open, got to the Tool’s menu, and select “XML Filter Settings…” from the index.

In the next dialog, select “New”. This brings up the filter settings dialog.

Enter the information in the “General” dialog. First give your filter a name. I call it the same as my xslt document, but you can choose anything. Next, select the application it will apply to (in this case, Writer). Next, enter a file type name. This is the name you will see in the Export dialog. The file extension should be xml.

Next, click the “Transformations” buttons. Since you are only concerned with exporting, you can ignore all fields except “XSLT for Export”. Here you just navigate to the folder where you have saved the OO02ID.xsl file and select it, click okay.

Start your document with an empty paragraph and give it a default style before really styling the rest of the text. OpenOffice’s engines turn any style in the first paragraph of a Writer doc to an automatic style in the XML output file (usually called “P1” or something), which will make it harder for you to map your tags to your styles in ID.

When you are done styling text, go to File>Export, and select your filter. (for a much better how-to, see this tech support site.

How it works:
Basically, the filter looks at your paragraph and character styles and creates XML elements around the styled text. When you import this file into InDesign, you can map the tags to the styles by name (see ID’s help menu for precise instructions), so all your text is automatically styled. This export filter also imports any tables you made in the Writer doc as CALS tables. These tables will not be styled.

The XSLT is designed for simple, regular document types, such as magazine articles, encyclopedic entries, resumes. It is not meant for complex documents. You may wonder why you wouldn’t just style a Word doc the same way, and place it in an InDesign document. For one, Word tends to bring in all of its default styles; so this method is cleaner. Also, you can use placeholders in InDesign to automatically position the text brought in from an XML doc. And once you’ve gotten the InDesign document to its final stage, you can better export the XML as an XHTML doc.

So, try it. Make any improvements you see fit. And please share your solutions with the community.

Gregory Ledger


About this entry