Noob help :) -- How to create XML tag w/ attrib's, how apply tag to selected para?
I have successfully used mapStylesToXMLTags() to apply tags to all styles.
But two things I have utterly failed at:
a) Adding attributes to the XML tags being applied
b) Applying an XML tag directly to a paragraph without using the auto-style-to-tag system
I can find few if any examples of this. And the documentation is quite opaque (or else I've not learned how to read it correctly. If so, I'd love a pointer to an InDesign Scripting API - reading - tutorial
)
ADDING ATTRIBUTES
I have tried static attributes:
myDoc.xmlTags.add(tagname, UIColors.RED, withProperties= {label:"test"});
I have tried various forms of dynamic assignment
tagname="foo";
tagAttr = 'myAttr:"Test"';
myDoc.xmlTags.add(tagname, UIColors.RED, withProperties= {tagAttr});
tagname="bar";
tagAttr = 'myAttr="Test"';
myDoc.xmlTags.add(tagname, UIColors.RED, withProperties= {tagAttr});
tagname="baz";
tagAttr = 'LabelVal';
myDoc.xmlTags.add(tagname, UIColors.RED, withProperties= {label: tagAttr});
...but no matter what I try, all I get after mapStylesToXMLTags() is the tag name and color. No attributes are set.
So then I decided maybe mapStylesToXMLTags() doesn't support attributes and I would have to painfully apply the tags myself (not too horrible since later I want to do some fancy tagging anyway...)
APPLY TAG DIRECTLY
I'm simply stymied on this one. I have looked at various examples and they all seem to do the opposite of what I want: they add content to an XML structure rather than apply an XML tag to content!
The closest thing I've seen is here, where he attempted to apply tags to paragraphs... but it was pretty much a total failure.
Anybody got a clue?
Thanks as always,
Pete
