Hi Sneig,
I have modifed the above JS code. Please try this.
If your document have only one marginal note then the script will through the error. So I have changed the reverse loop thats all.
var mydoc = app.activeDocument;
var rootElement = mydoc.xmlElements.item(0);
var linkElementList = rootElement.evaluateXPathExpression("//marginalnote[@type='mn1']");
for(var lp=linkElementList.length-1; lp>=0; lp--){
var myElement = linkElementList[lp];
var myTextframe = myElement.placeIntoInlineFrame(["21p9","5p"]);
//you have create the object style in you active document the object style name is "MN";
myTextframe.appliedObjectStyle= mydoc.objectStyles.item("MN");
}
alert("Proces Completed");
thx
csm_phil