Copy link to clipboard
Copied
I am generating catalogues in InDesign by importing a dynamically-generated XML, formatted in nodes according to the style I will later apply in InDesign.
I have an XML structured in the following way:
┕-Product
┝-Text
┃ ┕-Title
┃ ┝- TableTitle (n times)
┃ ┝-Table (n times)
┃ ┕-Description
┕-Image (n times)
Each "Text" in a "Product" corresponds to - and will be placed in - a TextFrame.
I applied to each node a formatting, so the "Title" node's content will have its "Title" paragraph style, the same for the table and the description.
The weird problem is that when I actually place the content in the TextFrame, having the base paragraph style selected and no character style highlighted, the last line of the "Description" gets the same exactly paragraph style of the title.
While I expect to have it applied the correct paragraph style as the rest, with this end result:
I don't really understand why InDesign is behaving like this. Can someone help?
Copy link to clipboard
Copied
I can't tell if you have hard paragraph returns between your description lines. If not, and you have a "Next Style" applied to your description (where next style is your Title style), that might be affecting the styles. That being said, I haven't worked with placing XML and don't know if it even honors Next Style settings. Just what came to my mind first.
Copy link to clipboard
Copied
Thank you for your reply, but unfortunately that's not my case.
To avoid all sorts of there problems, I never applied "Next style" to any of my paragraph styles, since the XML I'm working with is automatically generated from a database, which in turn is populated via a retail management software.
Moreover, InDesign retains all whitespaces and CRLF/LF originally present in the XML file; so indents are also interpreted as tabs or spaces, while line breaks are interpreted as paragraph interruptions. So i'm confident that it's not an issue related to linebreaks or paragraphs; to be sure I doulble-checked bot adding and removing CRLF in my XML file, but there still was the style issue.
So I'm planning to write a little script that reads the associatedXMLElements[0].markupTag for the last paragraph of each textframe and then applies the corresponding style, but I really wish there was a more reliable and easy solution.
Copy link to clipboard
Copied
did you ever find a tidier solution for this, gabry-el? i'm importing some fairly complex xml with a few different repeating elements, and the paragraph styles are all wrong for the first instance of each one. putting in a load of additional carriage returns in the parent tags forces the correct paragraph style, but it's not a great solution, and i think the scripting is beyond me!