Home Forums General XMetaL Discussion Searching for matching attribute values. Xpath the best way? Reply To: Searching for matching attribute values. Xpath the best way?

Derek Read

Reply to: Searching for matching attribute values. Xpath the best way?

I think you want to find all elements with an attribute called Target that have the value set in the item_val variable, right? If that's right then you probably want to replace this line:

var target_nodelist = ActiveDocument.getNodesByXpath("//*[@Target=item_val]");

…with something like this:

var target_attr_xpath = '//*[@Target="' + item_val +'"]';
var target_nodelist = ActiveDocument.getNodesByXpath(target_attr_xpath);

Reply

Products
Downloads
Support