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?
Reply to: Searching for matching attribute values. Xpath the best way?
January 7, 2010 at 8:02 pmI 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);