3

I'm trying to generate some content in InDesign CS5 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>
    </person>
    <person>
        <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?

2
  • Which version? (cs3, cs4 etc)
    – horatio
    Commented Nov 16, 2011 at 20:10
  • I'm using InDesign CS5.
    – Joe
    Commented Nov 16, 2011 at 20:13

3 Answers 3

2

You have to set up the structure in InDesign first, before you import the XML data. The procedure is a bit complex for an answer here, but you can find a good introduction here on Adobe TV.

If you're going to be getting into XML much, I highly recommend you spend time on InDesignSecrets.com (do a search on XML) and that you get and read James Maivald's "A Designer's Guide to Adobe InDesign and XML", not only the best introduction to XML for InDesign users, but also an excellent reference to keep on hand.

1

You can do this with data merge, but as far as I know, you must use CSV or tab delimited format, not XML.

The data merge palette is under the window->automation menu. You specify the data file, and then you can drag data field markers into your text boxes and style appropriately, then merge the files. Multiple records in a single document are not possible AFAIK when you are using a spread layout.

CS4 docs are here: ( http://help.adobe.com/en_US/InDesign/6.0/WSa285fff53dea4f8617383751001ea8cb3f-6c3ca.html#WSa285fff53dea4f8617383751001ea8cb3f-6c3ba )

and a real-world tutorial is here:

( http://tv.adobe.com/watch/instant-indesign/automating-a-catalog-with-data-merge/ )

1

Since you've got "Person: " and colons added to your original data, I'd go with creating apropriate XSLT to transform your XML before it'll be imported to InDy (there's an option to treat XML with selected XSLT when importing XML). Other than that it's just simple importing XML into InDy and mapping specific elements to specific styles.

To sum things up: use XSLT transformation while importing XML.

That's not the only way, but I'd go with that since you'll going to need XSLT knowledge (even basic) if you plan to use XML extensively in your workflow. I know XSLT is not a convenient and straightforward technology (could be designed more with people in mind) but it works.

By the way: to add "Person: " prefix before each paragraph, you could set your paragraph to be "bulleted" list with bullet set to empty character and "Text before" set to "Person: ". Try this :).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.