evaluateXPathExpression attributes of element with namespace
I have an xml like this (reduced example):
<root xmlns:test="http://ns.test.com/test/2.0">
<test:master>
<test:graphic control="ABC"/>
<test:textframe>TEXT</test:textframe>
</test:master>
<test:master>
<test:graphic control="XYZ"/>
<test:textframe>TEXT</test:textframe>
</test:master>
</root>As you can see the "test:graphic" element contains a "control" attribute.
I'd like to get all elements with a "control" attribute of the first "master" element with evaluateXPathExpression.
WITHOUT namespaces this code works:
var root = doc.xmlElements[0]; // doc is the current document
var xmlElements = root.xmlElements[0].evaluateXPathExpression("//*[@control]");
--> 1 result
But WITH namespaces it doesn't:
var namespaces = new Array(new Array("test","http://ns.test.com/test/2.0"));
var root = doc.xmlElements[0]; // doc is the current document
var xmlElements = root.xmlElements[0].evaluateXPathExpression("//*[@control]",namespaces);
--> 0 results
Althoug it works WITH namespaces on the root element (not on the first "master" like above)
var namespaces = new Array(new Array("test","http://ns.test.com/test/2.0"));
var root = doc.xmlElements[0]; // doc is the current document
var xmlElements = root.evaluateXPathExpression("//*[@control]",namespaces); //
--> 2 results
So i was wondering what am i doing wrong and how adress only a specific "master" element.
