How to generate InDesign content using XML data

≯℡__Kan透↙ 提交于 2019-12-23 03:27:06

问题


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?


回答1:


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:


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.




回答3:


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">


来源:https://stackoverflow.com/questions/8157829/how-to-generate-indesign-content-using-xml-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!