Home Forums General XMetaL Discussion Getting value of an attribute using getNodesByXPath Reply To: Getting value of an attribute using getNodesByXPath

Derek Read

Reply to: Getting value of an attribute using getNodesByXPath

David, try this:

[code]//XMetaL Script Language JScript:
var rng = ActiveDocument.Range;
var nd = rng.ContainerNode;
var id = nd.getNodesByXPath('ancestor-or-self::*[@id][1]/@id');
if(id.length > 0) {
Application.Alert(“Node Name: ” + id.item(0).nodeName);
Application.Alert(“Node Value: ” + id.item(0).nodeValue);
}[/code]

Reply

Products
Downloads
Support