Thursday, May 06, 2010

Preparing an InDesign file for an XML workflow

InDesign has great features for importing XML data from a database, or for exporting the contents of pages to XML format for re-use elsewhere. If you think that a project you're working on might someday become part of an automated XML workflow, here are some things to take into consideration as you set up your InDesign files.

General file setup

Your InDesign file should use master pages, margins and guides intelligently. Use margins and guides on your master pages to guide placement of text frames on your document pages.

Try to "flow" text in threaded text frames as much as possible, as opposed to individual text frames containing standalone bits of text. Your design and the type of data it contain will affect this, but it's a good rule in general.

All text must be fully styled with Paragraph and Character styles, and objects should be assigned Object styles where possible. No local formatting of text is allowed.

Rules for naming XML tags

XML data consists of text marked up with "tags" that look like this:

<head1>This is a headline</head1>

There are a few rules for how these tags can be named:

• Tag names cannot contain spaces
• Tag names are case-sensitive
• Tag names can’t start with “xml”, a number, or punctuation

Matching tag names to styles

A big part of any XML workflow, either into InDesign or out of InDesign, is to match up InDesign’s character and paragraph styles with XML tags. This can be done automatically if you’re lucky enough to have your XML tag names and your InDesign character and paragraph style names be exactly the same. So, when naming your InDesign styles, it's a good practice to follow the above rules for naming XML tags. If data with XML tag names already exist, consider naming your InDesign character and paragraph styles to match. If you’re in charge of creating XML tags, give them the exact same names as existing InDesign character and paragraph styles. This isn’t absolutely necessary, as there are other ways to map InDesign character and paragraph style names to XML tags, but it makes the process a whole lot easier.

Click here to read about four recent XML-InDesign automation projects I worked on, and the unique problems solved by each.

5 comments:

  1. The fact that your sample opening and closing tags don't match might be a bit misleading to people who aren't familiar with XML!

    This is a headline

    ReplyDelete
  2. @Jeremy: Thanks for pointing out the obvious tagging mistake I missed. The original post has now been corrected.

    ReplyDelete
  3. Good stuff, Keith! I enjoyed looking through the case study. Large projects with elegant solutions, like the one you came up with, are so satisfying.

    ReplyDelete
  4. Common InDesign XML worflows work best for data-centric XML source but not to well against document-centric XMLs like Docbook, TEI etc.

    Rountripping back to XML is also a head scratcher...

    ReplyDelete
  5. Is there any way to convert styles to tag automatically in Indesign exactly like tables, images etc.

    ReplyDelete