You don't need a script for this: use the 'clone repeating text elements' option in the import xml options dialog box.
Check out the 'work with repeating data' section in indesign help.
Thank you for your message… I'm not sure I'm doing this correctly…
I tried to import this XML with clone repeating text elements.
It works well but only for the first page. In this project, I will have 300 pages.
Those pages only contains 1 title and an adresse.
So during the import InDesign must duplicate the current page with the the layout and merge XML tag with the second row of the database.
So I still need a script to duplicate the master page xxx times. Link all xml fields with the correct text frame?
See my capture below.
Thank you very much for your advices
P.-S. I found a video here that explain how to do this (IDUG Berlin#31 – InDesign & XML - YouTube ) see at the 43 minutes.
I guess it is a good way for simple layout. How to do if I need more blocs? If I have multiples stories?
this is a feasible way you are going, except I would:
1. Add a scripting label to each textframe on the first page, then
2. Import the XML, then
3. Duplicate the first page according the the number of nodes in the XML, then
4. Link each XML node the the corresponding textframe on the page (finding it with the scripting label)
I don't understand German so can't figure out what's going on there.
I read how to do this in Designer's Guide to Adobe InDesign and XML by James Maivald. But it was a few years ago and I don't remember how I did it since I don't use it in my everyday practice. And I can't find the book and my exercise files on my new computer: I must left them on my old one. But I remember he explained with an example how to clone repeating elements and used no scripts in his book,
Well, I've finally found the book and the samples.
Here are a couple of screenshots illustrating the approach:
Before — a template containing only one page with one xml-element placed.
After — after importing an xml-file which has identical structure, more pages are inserted (235 in total) and variable data are added to each page. Note: each page has a different dog picture, breed. etc. InDesign does all this automatically: no script was used.
Are you interested in this or still stick to the idea of doing this by script?
Thank you very much for your help…
I still interested, I personally prefer your approach…
Is it possible to have your sources files (XML and InDesign)?
I the video posted before the process is probably the same but your document seems to be closed from mine.In the example that I have, the author only has one text frame…
Thank you for your comments again.