问题
I've got a bit of a problem at the moment. I'm trying to work with indesign (cs3) and xml.
Basically i have a template which is has 1 master dps, both pages have the same data (fields 1-5) but one is left aligned, one right - hence mildly different paragraph styles. What i want to be able to do is import xml and have indesign flow the data from the individual nodes into many pages.
eg xml format:
root
day
field1
field2
field3
field4
field5
day
field1
field2
field3
field4
field5
day
...
I can almost make this work by tagging the frames on the master pages, then creating pages and importing the xml, however it only flows the first 2 nodes into the pages reptitively for the total count of all the nodes.
I can also almost make it work by creating a page from the untagged masters and then tagging the frames with the field1-5 tags then importing the xml. This populates the first page, however i then can't find a way to make the rest of the data flow into new pages...
Am I missing something? Am I being a complete dumbass? If anyone can offer any help it will be greatly appreciated...
回答1:
I realize that this is an older question, but I believe I have some insight here.
InDesign will create frames and pages based on the size of an XML file.
Here is how... I'm referencing CS6 for this answer, but I've done this for years beginning in CS3.
Ensure your Indd template has at least 2 pages. These can be master pages mirroring right and left layouts. The pages must have the same primary text frame. This is an option when you create a new document.
Import your XML as usual. Be sure to tick off any options you need per your XML workflow.
Place the XML into the primary text frame. Since I typically flow entire documents, I select the root element and drag to the frame, but this will work on any node you select.
IF the content of the XML is larger than the frame can support, there will be a red plus sign (+) in a square box towards the bottom right of the frame. Click the plus sign and you'll get an arrow containing an paper icon and a representation of your XML content.
Goto the text frame on page 2. if you simply click inside the frame, InDesign will flow as much content as will fit in that frame and you'll need to repeat the process again by adding pages and placing content to the end.
However, if you hold down the SHIFT as you place the content, the paper icon will change to a swirly arrow. After you place, InDesign will autoflow the content to left and right pages until the end of the XML selection. If you have master pages, it will use those pages for the left and right throughout.
If you have your tags mapped to styles, the styles will display on the pages.
One note about mapping tags to styles...Perform your tag/style mapping prior to placing content. Otherwise, InDesign will need to redraw the pages. This is a memory-intensive action and could crash InDesign depending on your file size. If anything, it will take much longer than if you had mapped the styles before placement.
I hope this helps someone. I haven't seen this action documented by Adobe or in any other forums. There's many undocumented actions and features in InDesign especially concerning XML.
回答2:
You need to make sure that in your story editor, the tags accurately reflect the tags in your XML
below the root.
In your example, this will probably involve adding a 'day
' tag around your field1
, field2
, etc. tags.
Then when you use clone repeating text elements, all the days will be included.
回答3:
Quote from "A Designers Guide to Adobe InDesign and XML":
... Without scripting or third-party plug-ins, there’s no way (that we know of) to get InDesign to create multiple pages automatically from the structured layout as it appears after step 4 in Lesson 4-17. It is possible to create all six cards, just not automatically as you did in our other method.
It's based on CS3 though, so there might an an option in CS4 or CS5. I guess that means the only alternative is to use IDML. That seems rather complicated, but it might get the job done.
Quote from "Adobe InDesign CS3 and XML:A Technical Reference"
Clone repeating text elements. Select this option to replicate the formatting in the current file for several elements.
InDesign lets you clone a layout for repeating text elements. You can create a single formatting instance (in this example, for a recipe), and then reuse that layout to create pages for all of the other content.
... which suggests that it can be done.
But then again, from "Create placeholders for repeating content"
A key point, however, is that Adobe® InDesign® CS2 will never create new frames or add pages to accommodate new XML elements.
So, what's the final verdict? Reading and rereading everything carefully, I get the impression that this is what they are saying:
- It's not possible to have your design automatically replicated (new page) with the occurrence of a certain element.
- However, if you order your tags properly, then - using styles - you can make the contents of the XML document float into a text frame, which has the effect of having several parts of your XML document layed out in a similar way, over and over ago.
- However, in order to make sure that all text is floating into that text frame and tags are used over and over again, you will need to check the "Clone repeating text elements" option while importing. Otherwise (at least that's the impression I get; I haven't actually tried it myself) it will just apply the layout of the first occurence of the tag, and then ignore all consecutive occurences.
So, if you truly want to instantiate multiple pages, I think there is no other option than to export your design to IDML and have some sort of processor modify the contents of the IDML files.
回答4:
The answer above is not wholly correct. You have to read the whole book to get the right info. It is possible to create and flow XML data to multiple pages. The quote above is from the wrong section. It is talking about using the "frame-method" described in chapter 4 of the book. In fact, it is easy to do what you want using the "flow-method".
If the flow method doesn't work the way you want you can build the method you want using XSLT.
回答5:
One more suggestion, don't tag anything on the master pages. If you tag the master page only one data element can be used here. It will appear on every page.
Instead, tag only frames and placeholders on the body pages. Data can flow from cloned elements or all at once.
Everything you need is explained in the book A Designer's Guide to Adobe InDesign and XML.
If you want to build XML tables, the best way is to use an XSLT file to build the structure you want.
回答6:
The Quote: "A key point, however, is that Adobe® InDesign® CS2 will never create new frames or add pages to accommodate new XML elements." is wrong. InDesign CS2+ CAN and DOES create new frames and pages if you set up your layout properly. CS doesn't clone elements or layouts, but CS2 can and does.
InDesign will NOT create unlinked or standalone frames. The frames will be either linked together OR inline.
Since you can't see frame edges unless you turn them on, what difference does it make if the frames are inline? You can create them and flow them to new pages by using Paragraph "Keep" options.
Jim
回答7:
In Indesign go to
Preferences>Type>Smart Text Reflow
and select to be ticked When placing copy text will flow on to new page automatically
来源:https://stackoverflow.com/questions/2427681/indesign-and-xml-how-to-auto-flow-into-multiple-pages-with-differing-styles