by Andrew Zivic

Andrew Zivic

Table of contents

Created

16 April 2012

Prerequisite knowledge
 
Basic understanding of InDesign and DPS workflows.
 
User level: All
 
Required products
 
Sample files
xml_to_indesign_demo_assets.zip
By downloading software from the Adobe Web site you agree to the terms of our license agreement. Please read it before downloading.
 
Digital Publishing Suite can be used to create a wide range of digital publications, from very hands-on, highly designed magazines to template-driven newspapers and catalogs. This article describes how InDesign and DPS can be used to create structured publications that retain some of the design aesthetic of highly designed publications and also take advantage of the efficiency benefits gained by using InDesign Templates and XML.
 

 
Overview and demo

Structured publications are often published on a frequent schedule (such as daily or weekly) and often obtain content from many different sources, such as XML and RSS feeds. Publishers who produce these publications often wish to strike a balance between design aesthetic and time-to-publish efficiency. Ideally, they'd like to be able to combine the layout detail of InDesign documents with the efficient import characteristics of XML and HTML.
 
 
The great news is that this type of production is entirely possible by using a combination of InDesign Templates, XML tagging, InDesign Scripting, and DPS Import.
 
 
XML, scripting, and InDesign
The demo assets and step-by-step instructions of this article demonstrate a simple example of how the technologies work together. For more details on any of the features, please refer to the XML and Scripting sections of the InDesign documentation. Note also that each of the actions below can be called using InDesign scripting. Automating the XML import process with InDesign scripts can unlock a level of efficiency needed for producing weekly and daily digital publications with DPS.
 
 
Running the demo
  1. Download and unzip the XML_to_InDesign_Demo_Assets.zip file.
  2. Open the ArticleTemplate.indt InDesign Template file in InDesign. Note that this results in creation of a new InDesign document with empty placeholder frames for content.
  3. Choose File > Import XML, select the Article1.xml file, and click through the default choices in the import wizard.
  4. InDesign imports the content from the XML file and places it in the corresponding placeholder frames that have been tagged with each of the XML element names.
  5. Repeat steps 1–3, but select Article2.xml. Note that the same InDesign template is now populated with different content.

 
The process

A logical way to begin creating the assets for your automated production system isby looking at the data feed(s) you have. In this case, Article.xml is a single file that contains all the data for this article. In real-world situations, article data might come from live data feeds (XML, RSS, or elsewhere) or it might be taken from a home-grown data aggregation system. Either way, it's important to start by understanding the structure of the data you're working with.
 
 
Map XML tags to frames in an InDesign template
The Article.XML file contains everything I need to generate an article: <title>, <teaser>, <byline>, <caption>, <text>, and three images <image1>, <image2>, and <image3>. In an automated environment, I would expect that each article I generate in the magazine would consist of these items, and the InDesign template I use will contain placeholder frames where the data for each of these items should go.
 
The next step is to create an InDesign template. This is easily done by opening a blank InDesign document and saving it as an InDesign template (File > Save As > InDesign Template (.indt). When an InDesign template is opened in InDesign, it copies all the existing contents of the template (including, in this case, empty placeholder frames) into a new, untitled InDesign document (.indd).
 
Next, add empty frames in the document where you want the images and text content to be placed. In this case, I created three empty frames for the images (one on each page), an empty frame for the title, teaser, and byline on the first page, and four separate frames (linked) on the second and third page to hold the article text.
 
The final step is to tag each of the empty frames with the corresponding content tags in the XML document. InDesign facilitates this process in the Tags panel (Window > Utilities > Tags) by using the Load Tags function in the pop-up menu. Click this function and point the Open File dialog to the Article.XML file.
 
The end result is a complete list of all the tags (color-coded) in the XML document now imported into the Tags panel. To associate each tag with its corresponding placeholder frame in the document, right-click the placeholder frame, select Tag Frame, and then choose the matching XML tag (see Figure 1).
 
Selected frame is tagged "caption"—indicated with underline in the Structure pane, and highlighted in the Tags panel

Selected frame is tagged "caption"—indicated with underline in the Structure pane, and highlighted in the Tags panel

 

 
Define XML structure and import assets
You're almost done now. The final step is to build the XML structure for the data that will be imported. Start by opening the Structure Pane (View > Structure > Show Structure). Note that a root tag named "root" has been inserted automatically. Since the root tag in the XML document is "article", this needs to be replaced. To do this, click on the "article" tag in the Tags panel and drag and drop it onto the root tag in the Structure pane. This will replace the name "Root" with "Article."
 
Now the document is ready to import the XML data. Select File > Import XML, and click through the default options. The end result is the data in each of the tags in the XML document is loaded into its corresponding placeholder frame in the InDesign document (see Figure 2). You can name and save the document into a unique directory—and then add it to your folio as an individual article.
 
Figure 2. Document, after importing the Article1.xml file

Figure 2. Document, after importing the Article1.xml file

 

 
Summary
Although the demo illustrates the import of only two articles, the implication is that the process can be used (and automated) to import as many articles with the same structure as needed for a publication. The power of this concept is enormous—it's possible to build a single, nicely designed template with a structure that's common to all articles, and then repeat the import process for every article that's designed for that format. The generic process is as follows:
 
  1. Open your empty InDesign template.
  2. Run the Import XML process.
  3. Save the document.
  4. Add it to your folio.
  5. Repeat these steps for each article.

 
Where to go from here

If you want to take this a step further, check out the Scripting documentation in InDesign Help. Using InDesign Scripting, it's possible to automate the first three steps listed above. Be sure to save your documents into unique subdirectories with the naming conventions required for DPS folios. Once you have a set of subdirectories populated with all the article content, you can use the Import function in the Folio Builder panel to import all the articles into a single folio. Voila! You've automated the process of creating an entire folio—and you can repeat and run this process as often as needed: monthly (for a magazine), weekly (for a weekly), or daily (for a newspaper).