InDesign XML Mapping XML Tag script

Hi Champs,

I need a script to map every xml tag to style sheet.

For better understand:

I have import an XML file in indesign template. Now on the hirarchy base of xml tagging, I will have to apply tags over it

I will start work on it from today, if some body have allready done it, then please forward it to me.

I am using InDesign CS2. Mac OSX.

Thanks in Advance…


I’m not sure, but I had a “programmer” trying to sell us on InDesign’s XML features a few years ago. If I remember correctly, if you have a template set up right, the proper DDT’s (or something like that) then the XML should map right to the style sheets. The need for scripting would be to go the other way and map the style sheets to the XML structure if the text was brought in and styled through the traditional method.

Hi Jerome,

Thanks for reply.

I have proper Template with style sheet, and DTD. But problem is that we can’t map all the styles of XML with style sheet. becuase as per DTD “title” tag in XML occurs so many times with different element.

For example “title” will come with any BoxType Item, or with any Floating Type Element. But in InDesign we are putting different styles.

So, mapping is not possible here.

By the way, if you have that script then please sned to me at my id., so that if required I can change the code and make suitable for me.



I dont have a script for mapping style sheets to XML, though I have seen it in one of the InDesign books. I havn’t been envolved in planning any XML workflows out in a while. A few years ago, when InDesign 2.0 came out, we had a programer that was touting the benefits of using XML to build documents. What I remember is that it works great if you have everything worked out up front, layouts, images, page breaks, etc. However, this is rarely the case in page production. I seem to remember problems similar to what you are describing where some items might have the same tag for the XML, like for a title or bulleted list, but there might be multiple styes in the InDesign document that they need to be applied for the various elements that they actually go into.

I don’t know if there is a solution to this, it might be possible to have a script evaluate the document after the XML is flowed into the document and change the styles applied to what they need to be based on the elements that they are placed into in the InDesign document. The problem with this is finding a solution that if flexable enough to be implemented for multiple projects rather than a custom solution for each project, which would probably be counter productive in the long run.

Hi Jerome,

There is good news, we can apply style sheet where we want.

In xml file you will have to just code “aid:pstyle=“style””.

pstyle for para style
cstyle for character style.

you can search from web “InDesign XML pstyle”

You will get enough information about it.