I am extracting a array of items of an xml list, I...
# suitescript
t
I am extracting a array of items of an xml list, I want receipt node from receipt_list. But when I am doing
var receiptList = xml.XPath.select({
        
node: xmlDocument,
        
xpath: '//receipt_list'
    
});
    
var itemNode = xml.XPath.select({
        
node: receiptList[0],
        
xpath: '//receipt'
    
});
itemNode.length gives me 5 instead of 4. Getting the other one too from outside receipt list.
b
use the self specifier (.) in front of your xpath to make your xpath search relative to the current node
keanu thanks 1
🙏 1