Mapping InDesign styles to XML tags

I’m very new to Applescript. I’m pretty sure that what I want to do is dirt simple but, as always, it’s just getting the right start that’s eluding me.
I have to export XML from an INDD file, and this involves mapping styles to XML tags. InDesign helpfully provides this functionality. However, we’re talking upwards of 100 styles in these documents, and telling InDesign which tag to map each style to, manually, every single time I need to do this, is beyond tedious, especially since half the time InDesign crashes on me and I have to start all over. So, would some kind soul who’s faced this already please give me a snippet to start with? I can manage the basics of the script; I just need one good example that is specifically about mapping styles to tags. Any help much appreciated!

Matt “Wait, that didn’t come out right” A.


This may or may not help with your problem. I have an applescript that renames paragraph styles to legal xml “names” then creates xml tags based on these style names. My understanding is that you don’t need to map styles to tags if they are named exactly the same.

You can find the script here: