(Also posted in ID Scripting forum, not getting response, thought I'd try here...)

I've got a situation where I need to quickly and repetitively apply XML tags and attributes in InDesign CS. (I may also need to do this in CS2 down the line, but CS is the pressing problem.) What I'm trying to do is:

1. Apply an XML tag (in this case, "span") to a manually selected range of text.

2. Apply a specific attribute ("class") and attribute value ("category") to the XML tag that was just created.

(Desired end-result in XML: <span class="category">Selected Text</span>)

Simple, right? Except I can't figure out the AS syntax for applying these tags and attributes to save my life. Looking at the InDesign CS dictionary, there's a command called "markup" that seems like it should work, but I can't figure out how to get it to apply to a selected range of text.

Anybody got any good ideas?