1

I'm trying to generate some content in InDesign by importing XML data, but I can't figure out how to do it. Here's what I have:

XML

<stuff>
    <person>
        <name>John</name><age>42</age>
        <name>Oscar</name><age>39</age>
    </person>
</stuff>

And here's what I want the result to look like:

InDesign

Person: John, 42
Person: Oscar, 39

How do I go about doing this? Is this the right site to post a question like this?

Joe
  • 3,804
  • 7
  • 35
  • 55
  • This is very specific to InDesign. It may involve InDesign scripting, or it may just be configuration. It is probably more appropriate on the Adobe InDesign forums. – Jim Garrison Nov 16 '11 at 23:25
  • In what way are you trying to import it? Menu commands inside InDesign? An InDesign plug-in? An InDesign Script? – MatsT Nov 18 '11 at 17:01
  • @MatsT, there's an option on the File menu called "Import XML" that I *think* is supposed to do something like this. There's also the Structure and Tags panels that I'm pretty sure are involved in the process. These are all things that come included with InDesign. – Joe Nov 18 '11 at 18:46
  • An alternative is [Importing XML into InDesign](http://stackoverflow.com/a/16440964/287948). – Peter Krauss May 08 '13 at 12:50

3 Answers3

3

This is actually very easy to do this. Complete directions can be found in the book a Designer's Guide to Adobe InDesign and XML.

The easiest way to do this is to import your XML source into InDesign. Drag one data node into the layout. Add the repetitive text elements in front of your data, such as "Person:" Format all your placeholders (keep them in the order appearing in the xml) and then delete all nodes from the structure panel that aren't part of the main placeholders.

Re-import the XML source and in the Import xml dialog check the boxes: clone repeating elements..., only import elements that match..., and "ignore whitespace..."

This will being in the XML data and format it in the manner you want. Your layout may be structured only for one data node. To flow the rest, just drag the appropriate parent element from the structure panel to the layout.

InDesign has limited XSLT capabilities, mostly the options in the XML import options dialog. If you need anything more elaborate you'll have to use an external XSLT during import.

InDesign only supports XSLT version 1.0

2

Pandoc has lots of importers (for example from HTML or DocBook XML) and can now export to InDesign's ICML format (an open subset of the XML-based IDML format). The resulting file can then be placed in InDesign like any other external dependency.

There is also a usable XSLT stylesheet to convert XHTML directly to InDesign's ICML format.

Make sure your HTML input file starts with:

<?xml version="1.0" encoding="utf-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml">
mb21
  • 34,845
  • 8
  • 116
  • 142
2

This isn't a programming question so not really suited for stackoverflow. You could check out http://help.adobe.com/en_US/indesign/cs/using/index.html, there is a section concerning XML. If you're still having problems you could try asking in the InDesign community forums at http://forums.adobe.com/community/indesign/indesign_general.

MatsT
  • 1,759
  • 3
  • 20
  • 33