Fan of creative technology, elearning, instructional design and a little geeky

Adobe InDesign and XML: A Reference Guide

The following is a reference guide I have compiled over time for those of you who are looking at doing a little more with XML in InDesign (originally published Feb. 2011, last updated Feb 2018). If you have any extra information you’d like to see added to this guide, feel free to message me.

Mapping XML tags to InDesign styles

Mapping XML tags to styles, creates a link between content marked up with an XML tag and a paragraph, character style, table or cell style and will subsequently format the run-in XML data in the InDesign document based on the mapping references .

To map XML tags to various InDesign styles:

  1. Select Map Tags to Styles from the Tags panel menu or the Structure pane menu.

All Tags available in the Tags panel are listed. The Style menu provides a drop-down menu next to each Tag that contains a list of all Paragraph, Character, Table and Cell Styles to which Tags may be mapped.

  1. Click Map by Name in the Map Tags to Styles dialog box to automatically map matching Tag and Style names. All matching names are automatically linked up. For any Tags not mapped, you can choose an alternative mapping option from the drop down-menu.
  2. After you’ve linked all used tags to document styles, click OK.

Imported XML data is formatted now automatically formatted using the matched paragraph, character, table and cell styles.

InDesign Namespace

When defining attributes that refer to a specific eXtensible Markup Language Namespace (XMLNS), the namespace must be declared as part of the XML. Where InDesign 4.0 and 5.0 namespaces are used, both namespaces may be entered in the Root element of the XML file or else inside the element referring to them.

<Root xmlns:aid="" 

Figure 1. InDesign Namespace reference for version 4 and 5.


An image reference in XML must provide a full path-name to the image location as a href attribute (this is similar to how the img tag works in HTML). When you apply an Object Style to the graphic frame that sets the frame options, you can control the positioning and scaling of the image as it is being placed in a tagged graphic frame during XML import.

Image element sample
<Image href="File:///Volumes/DOCS_IMAGES/2008_Sydney/IMG_1806.JPG"></Image>

Figure 2. Example of Image element with reference to image location

Image reference examples
Images stored in same folder as xml file href="File:///image.jpg"
images stored in a sub folder inside the same folder as xml file href="File:///foldername/image.jpg"
Images stored anywhere and referenced by accessing the full path name. This is referred to as an absolute path name In the Documents folder on your PC: href="File:///C:/Users/username/Documents/
In the Documents folder on your Mac: href="File:///Users/username/Douments/
Where username is to be replaced with your username (in my case that would be “carijansen”) and RestOfPath points to sub and sub-sub-folders inside the Documents folder
Images stored on another volume (server) from a Macintosh OS: File:///Volumes/VolumeName/RestOfPath
Where VolumeName reflects the volume.
from Windows: File:///Servername/RestOfPath
Where ServerName reflects the name of the Server you’re connected to.

Figure 3. Image path samples.


Tables in InDesign CS3 and higher can be formatted using Table and Cell Styles.

These styles may be applied as part of the XML import by including appropriate style attributes to the XML table. The following attributes can be applied:

aid:table defines that the element is a table
aid:trows total number of rows the table contains
aid:tcols total number of columns the table contains
aid5:tablestyle (ID5 specific), Table Style that formats the table
aid:theader defines cells as being part of a header row
aid:tfooter defines cells as being part of a footer row
aid5:cellstyle (ID5 specific), Cell Style that formats table cells
aid:crows number of rows across which the cell spans<
aid:ccols number of columns across which the cell spans
aid:ccolwidth column width of cell, measured in points

Figure 4. Table attributes.

XML Example
<Table aid:table="table" aid:trows="2" aid:tcols="4" aid5:table style="TableWithHeader">
<Cell aid:table="cell" aid:theader="" aid:crows="1" aid:ccols="4" aid:ccolwidth="134">Table heading here</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="134">Fruit flies</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="134">23</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="134">34</Cell>
<Cell aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="134">234.9</Cell>

Figure 5. Table XML sample.

Note that a table cannot be placed into InDesign without its parent Story element. The aid and aid5 prefixes used as part of the attribute names that define specific cell formatting are indicative of these names being part of the InDesign 4.0 and 5.0 XML namespaces.

Paragraph and character styles

Formatting with paragraph or character styles can also occur during XML import and works similar to using the table attributes. Use the following attributes for paragraph or character level formatting:

Attribute Description
aid:pstyle Paragraph Style formatting
aid:cstyle Character Style formatting

Figure 6. Paragraph and character style attributes.

XML example
<title aid:pstyle="head_large">van Gogh Art Exhibition</title>
<intro>Vincent Willem van Gogh <dob aid:cstyle="smallcaps">
(30 March 1853 – 29 July 1890)</dob> was a Dutch ... most popular and most expensive pieces.</intro>
<body>Van Gogh spent his early dult life ... until he encountered Impressionism and Neo-Impressionism in Paris.</body>

Figure 7. Paragraph and character style XML sample.

Special characters

List of special characters (I’ll add to this over time, feel free to message me if you have additions):

Character Description
en-dash &#8211;
em-dash &#8212;
en-space &#x2002;
em-space &#x2003;
 tab &#x0009;
 1/4 &#x00BC;
 1/2 &#x00BD;
 3/4 &#x00BE;

Figure 8. Special characters.

Similar posts
  • How to change the colour of bullet points in InDesig... A few weeks ago I recorded a short quick tip tutorial. InDesign’s Control panel, gives users a quick and easy way to format text as a bulleted list. Highlight the text, and click the Bulleted List button in the Paragraph Formatting Controls mode for the Control panel. This applies a universal bullet character as the [...]
  • Creating a pop-up window in a PDF with Adobe InDesig... In the following YouTube tutorial, we’ll create an interactive PDF from Adobe InDesign, in which we click on a button, which in turn opens up a simple pop-up window containing a close-box. When the close-box is clicked the pop-up window disappears [...]
  • InDesign: Facing pages with odd-numbered left pages Back in 2004 I wrote a tip for InDesign CS on how you could have the first page of your document be a left page AND have it start with page number 1. It’s hard to believe this is almost a decade ago… But a recent question on Facebook, made me think I should really [...]
  • Negative Lookbehind – GREP for Designers This is the fourth and final blog-posts in a series of posts on lookaheads and lookbehinds in GREP, written after speaking at the Perth InDesign User Group. My speaker notes are also available: What is GREP? (PDF download) (2.4Mb). In the previous three posts I briefly introduced GREP, and we took a look at Positive [...]
  • Positive Lookbehind – GREP for Designers This is the third in a series of blog-posts about GREP, written after speaking at the Perth InDesign User Group. My speaker notes are also available: What is GREP? (2.4Mb PDF download). In the previous two posts I briefly introduced GREP, and we took a look at Positive Lookahead and Negative Lookahead. In this post [...]


  1. December 16, 2021    

    This new book The Financial System Limit explains why private sector debt matters far more than government debt.
    The author says:
    “Personal debt is a developed-country problem.
    Prosperity has been bought, literally, on credit.”

    “Markets have only given generous rewards for as long as central banks
    have successfully expanded the supply of credit.”

    “Borrowing to invest, for example in property, will go out of fashion.”

    “Centralised decision-making is vulnerable to elementary mistakes.”

    Extracted from:
    e-book 9781907230776 in all good e-book stores now , two hard cover
    and a paperback print editions. Paperback available now in many countries except USA and
    UK, hard cover editions USA May 2021, UK 23/8/21

  2. Boschvei Boschvei
    September 29, 2021    

    European glory, and even after

  3. Dormanojv Dormanojv
    August 31, 2021    

    Western Europe also formed

  4. Vortexzai Vortexzai
    August 26, 2021    

    Century to a kind of destruction:

  5. Independentmka Independentmka
    August 23, 2021    

    new texts were rewritten

  6. Carpetfnt Carpetfnt
    August 16, 2021    

    European glory, and even after

  7. Nespressonpa Nespressonpa
    August 5, 2021    

    handwritten books were made,

  8. BlackVueavt BlackVueavt
    April 18, 2021    

    consists of the book itself

  9. Sunburstbbj Sunburstbbj
    April 17, 2021    

    among them acquired “Moral

  10. Furrionnsq Furrionnsq
    March 24, 2021    

    Europe, and in Ancient Russia

  11. Flashpaqutg Flashpaqutg
    March 13, 2021    

    Since the era of Charlemagne

  12. Fingerboarddtr Fingerboarddtr
    February 23, 2021    

    number of surviving European

  13. Incipiorkg Incipiorkg
    February 13, 2021    

    Europe, and in Ancient Russia

  14. January 15, 2021    

    you’re truly a excellent webmaster. The website loading
    speed is incredible. It seems that you’re doing any distinctive trick.
    Also, The contents are masterpiece. you have done a great process on this matter!

  15. Universaldly Universaldly
    December 26, 2020    

    Manuscript is a collective name for texts

  16. Jon Jon
    October 5, 2020    

    WOW just what I was searching for. Came here by searching for website

  17. Tonua Tonua
    June 3, 2020    

    Had Adobe released any new aid namespace constructs for apply Object Styles (to graphic frames, for instance) during XML import?

  18. Sunil Yadav Sunil Yadav
    June 5, 2019    

    Is there any xml structure for creating and applying group paragraph style?

  19. liuhua liuhua
    November 21, 2018    

    Hello, does the aid instruction set of the XML file have all? I need footnotes, Pinyin, picture size and other AID processing instructions, so as to better XML typesetting.

  20. Neil Neil
    September 25, 2018    

    Hi Cari,
    I’m working on producing a suite of InDesign documents, which will be populated using XML data, taken from our website.
    Some of the fields have inline styles, which appears as part of the text, when imported in to InDesign. (see below for example)

    <![CDATA[ Students often elect to undertake field trips either individually or as a group as part of their broad range of study. Bristol Zoo and a local zoo farm are favorite locations for the study of animals for Action Analysis studies.You’ll be given the opportunity to work with the British Film Institute (BFI) Animation Boot Camp, which provides workshop instruction for young people from around the UK. ]]>

    Is there any way to get InDesign to recognise this styling and either implement it or remove it?


    • Neil Neil
      September 25, 2018    

      Have just realised that all the inline styles have been implemented, here in the comments section. In the document , etc appear as text.

      • Neil Neil
        September 25, 2018    

        Drat, it did it again, even without closing tags. :/
        Hopefully you get the idea.

Leave a Reply

Your email address will not be published. Required fields are marked *