text.parentTextFrames returns an array of all the textframes the specified text runs through.
so you'd want:
Ups, a bit to late, sorry for that ...
first, selection is a array. So you have to loop through the items to get each parent text frame.
if selection[someitem] is word or paragraph you can use parentTextFrames, which is an array again
if selection[someitem] is a table it's parent ...
if selection[someitem] is a anchored object it should be parent.parentTextFrames
Guess I'm missing a lot possibilities ;-)
Thank you for your reply. I should have thought about what I really needed. I'm trying to the the xml for the textframe of the selected text.
I have l2elements = app.selection.parentTextFrames.associatedXMLElement.xmlElements
is always 0;
Thanks in advance.