If you could work code similar to the following into your XFT it might not need any further adjustment in the future. Run this code after placing your selection inside an element to see a list of attributes with values.
//XMetaL Script Language JScript:
var rng = ActiveDocument.Range;
var msg = "";
var attrs = rng.ContainerNode.attributes;
for(i=0;i<attrs.length;i++) {
msg += attrs.item(i).nodeName + "=\"" + attrs.item(i).nodeValue + "\"\n";
}
Application.Alert(msg);