Search code examples
xmladobe-indesign

Creating a bulleted list in InDesign with XML


I have tried for hours to get a bulleted list working in InDesign where each item is on its own line without adjusting the formatting after the import.

This is an example of the XML structure I have to work with:

<?xml version="1.0" encoding="UTF-8"?>
<Root>
    <list>
        <item>1</item>
        <item>2</item>
        <item>3</item>
    </list>
</Root>

I set up a paragraph style for bullets, and am using it on the <item> tags, but after the import they appear inline:

enter image description here

How do I get each item to appear on a new line without manually putting returns in after the import? This is going to be part of a much larger document with thousands of lines of XML, and I want to automate the process.


Solution

  • In XML new lines between nodes are ignored. Most of the XML exports from the databases do not have new lines between nodes.

    InDesign does care about the new lines, so all three item nodes are rendered as a single paragraph when you place your XML into the text frame.

    Bullet lists are a settings of a paragraph style, you need to insert new line characters before every item node in your list node

    You can tweak your XML or add CR to XSLT. I usually add

    &#13;
    

    in XSLT after my bullet list item.