Creating a Dynamic Catalog with InDesign Templates & XML Data

My task for a recent project was creating a print catalog. The catalog content was constantly being updated, but each entry needed to have the same visual style. I knew there must be a way to do a majority of the design work and then “data merge” the content to the style, but it sure wasn’t easy to figure out. 

It took a ton of time piecing together a number of blog posts and experiments to find a repeatable process that worked for me. So here is my solution, combining InDesign and XML.

For this example, we will be creating a catalog of plants using this sample XML file of plants from W3School.

A catalog of plants we will use as an example.

Creating an InDesign Template

The template will allow you to easily and repeatedly import your data into the layout you have created. This step is time-consuming, but it will pay off down the road.

The first thing we want to do is create a new file for the catalog size specifications you want. Import the XML file into a new InDesign file using “Choose File > Import XML.” Then use the file browser to navigate to your XML file.

Click “Show XML Import Options” and select “Merge Content.” Then press OK to bring up the import options.

XML Merge Content Options Modal.

From these options, you will likely want to select:

  • Create link
  • Clone repeating text elements
  • Do not import contents of whitespace-only elements
  • Delete elements, frames, and content that do not match imported XML

Press OK to import the XML data.

In the top left, you’ll find the structure pane with our catalog of data.

Find your way to the structure pane or use “View > Structure.” This will show the visual tree of data in your XML file. Expand the root element (Catalog) to view all the Plant child nodes. You will then select and delete all of the Plant nodes except the first. Then click and drag the root Catalog node to the page.

The non-styled data in the InDesign document.

At this point, you should see the non-styled data listed on the page. Select that text by clicking on it, then right-click to bring up the menu and select “Edit” in Story Editor.

InDesign XML Story Editor with one Plant node’s tags shown.

In the Story Editor, you can start to alter the layout and view the tags which come from the Plant child elements. (This can also be done on the InDesign page.) Let’s put line breaks between each element. Next, we’ll add labels for each of the data points. After we have our rough structure in place, we can start to add text styles.

We have added labels before each of the Plant tags.

We added a line break before each Plant tag.

If you create custom Character Styles with the exact name (caution: it is case-sensitive) for each tag, you can automatically map those styles to the tags. After you have created the Character Styles based on your design, go to the Tags window and click the Additional Options button. This will bring up a menu where you can select “Map Tags to Styles.” There, you will see a modal where you can map the styles to a tag. There is also a handy “Map by Name” button below the table, which will quickly match all the existing tags with the available styles.

Indesign Map Tags to Styles Modal
InDesign Map Tags to Styles Modal

This is the completed template for this example. When we import all the data, each node in the XML file should look the same.

Once you have set up the layout the way you want, you can File > Save As > an InDesign template file. Close your open InDesign file and open the template we just created.

Bring It All Together

Now we need to bring in the data. So we’ll want to File > Import XML… again just like before.  Choose the same options as above. 

After you press OK, you should see your template repeated for each node in your XML data file.  What is really cool is that all the data is copied over, including all the non-tags or any icons you might have put into the template. In this case, the labels for each tag show before the tags for each node in the XML file.

You did it! Each node shows up with the correct label and style from the template we defined.

You now have the basics to expand your layouts, but in data complexity and visual layouts.

  • Christoph Letmaier says:

    Hi Bryan!

    Very nice article, but the question is: if you make some changes on the XML input data, eg. new prices, other text etc – can you update the content without loosing the formatting?

    • Bryan Elkus Bryan Elkus says:

      Hi @christoph,

      Thank you for your comment. Yes if you check the linked option when you import the xml feed the next time you open indesign and the content of the xml feed has been altered it will ask you whether you want to update it or not. Per your other question, one way might be too output different xml documents using the same tags and you should be able to import as we stated above. Best of luck!

  • Christoph Letmaier says:

    Another question: is it possible to choose different XML input data for one layout? Eg. i made several catalogue for a customer in different languages, but the prices are the same for all languages. It would be handy if it is possible to update only the prices.

  • Comments are closed.