Skip to main content
Known Participant
March 31, 2020
Question

multipage XML automatisation

  • March 31, 2020
  • 1 reply
  • 2103 views

Hej there,

I am attempting to build an automated multipage InDesign document via XML – one long XML (which changes for every month) and one 1-page INDD master, which combine to one ~30-page INDD per month.

 

It works perfectly when I have a 30-page document with all the XML-elements linked to all the textframes on every page. But the next step would be to have just one page in InDesign and have it automatically expand according to the XML. That way, I wouldn't have to do the same thing 30 times when something has to be changed structurally or with the fixed elements...

 

According to the following thread, it should be possible without scripting (which was my first thought, too) and it sounds rather simple: https://community.adobe.com/t5/indesign/build-xml-structure-by-scripting/m-p/11012846?page=1#M180624

(I posted there, too, but as it's marked as solved, I was uncertain whether it'd get any attention)

 

So I reworked my project file, but to no avail.

Then I tried it in a dummy XML file + project:

 

<content>

<event1>
<a>ASDF1</a>
<b>QWER1</b>
</event1>

<event2>
<a>ASDF2</a>
<b>QWER2</b>
</event2>

<event3>
<a>ASDF3</a>
<b>QWER3</b>
</event3>

</content>

 

... but nothing changed. Just page one worked.

 

I tried to have <event> containers without the digit, I tried adding empty pages beforehand and I tried out the different import-options – no luck 😕😕 I also played around with the master page, but it doesn't seem to have anything to do with it...

I'm out of ideas, do you have any? °-° 🙂

 

Thanks and best wishes

Mathis

This topic has been closed for replies.

1 reply

Inspiring
March 31, 2020

Make sure your document is set up with Primary Text Frame set to true. Have a paragraph style established for each tagged element (one for "a" and one for "b"--maybe call them itemA and itemB)

Import the XML file and drag from the root element to the first page (also the first threaded text frame). You now have all elements on the first page. Using the Tag panel (under Window > Utilities), set Tag to Paragraph styling (Map Tags to Styles in hamburger menu) see screenshot below. For the first tagged paragraph, set its paragraph style to Keep Options > On Next Page. (Text will now start on page 2).  Note: this assumes both items will be in the same Primary Text Frame (first threaded text frame by default).

 

 

MathisseAuthor
Known Participant
April 1, 2020

Thank you very much, Hopkins!

 

It works in my dummy project 🙂 Very interesting.

<a> and <b> in one text frame on page 2 and 3, page 1 empty. (I deleted <event3> for now)

 

But can I also have <a> and <b> in two separate text frames now? 

 

 

This only half-works manually, when I drag the containers in their frames on page 1. Then, when the XML is loaded, page 1 (no page break then) looks fine, but on page 2, <b> is underneath <a> in the primary text frame again. So this is no way to go.

Which makes sense in this context, but doesn't fit my needs as I have more complex designs that need to be retouched a lot.

 

This is probably what you mean by:

Note: this assumes both items will be in the same Primary Text Frame (first threaded text frame by default).

 

But it seems to somehow be possible, when I look at the old thread I posted – there are multiple text frames with changing content.

Or am I missing something...?

 

Thank you & best wishes

Mathis

 

Pictures of my trivial structure panel with only "Root" inserted on page 1 and my failed attempt of manually dragging <a> and <b> in text frames prior XML on page 1:

 

MathisseAuthor
Known Participant
April 20, 2020

Glad you spotted the problem. Yes, how you set up the document makes a ton of difference with the master page (and master text frame(s)). Yes, keep the thread open. Hopefully others will find this informative.

Shirley


Hi again,

 

apart from everything else working wonderfully 🙂 I have one question:

I am importing a <picture href="file:///...jpg"></picture> container.

When working with my previous, bad method, it worked fine.

Now with the primary textframe, the image is created as an Anchored Object and the option (something along the lines of...) embedded.

This way, I can only move it oh-so-little vertically, until it leaves the text frame...

 

When I change to Anchored Objects –> Options –> Custom, I can move the image around as I like, but this doesn't solve the automatisation problem as I'd have to do this every time for every image and there's this other, connected problem:

It is imported as big as the image actually is, not resized to as big as the frame it should be in. As it's floating around outside its actual frame, of course it doesn't respect its boundaries.

 

This isn't a big problem yet, as there are only few and static images in use (varying, only on some pages), but when XML will be connected to my image database in the future, it might become a biggy.

 

Is there some other way to implement images in XML or to import the XML in InDesign? I couldn't find anything.

Thinking about it, I guess it might be a bit of a struggle to do this with a primary text frame, right?

 

Thanks & best wishes,

Mathis