InDesign JS: evaluateXPathExpression function not passing the colon attribute vaule issue
Hi Guys,
I have tried to pass colon attribute to evaluateXPathExpression but not working please help me.
Attributes: @xml:id, @aid:pstyle
var doc = app.activeDocument;
var rootElement = doc.xmlElements[0];
var xPathQuery = "//section[@role and @xml:id and @ele-id]";
var matchedElements = rootElement.evaluateXPathExpression(xPathQuery);
if (matchedElements.length > 0) {
for (var i = 0; i < matchedElements.length; i++) {
var productNode = matchedElements[i];
var priceNodes = productNode.evaluateXPathExpression("title[@ele-id and @aid:pstyle]");
if (priceNodes.length > 0) {
alert("Section " + (i + 1) + " Title: " + priceNodes[0].contents);
}
}
} else {
alert("No Product elements found in the XML structure.");
}