This is a follow up to "Power Automate xpath". I have followed the detailed instructions posted by @Paulie78 to the letter with out success. The xpath() function returns the following error:
Function
xpath(outputs('XML'),concat('//Array[ID/text()="', item()['ID'],'"]/Size/text()'))[0]
Error returned:
InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language expression 'xpath(outputs('XML'),concat('//Array[ID/text()="', item()['ID'],'"]/Size/text()'))[0]' cannot be evaluated because property 'ID' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.
If I replace item()['ID'] with '3333', the xpath() works as expected and returns the expected result.
Flow:
 | [ { "ID": "3333","Object_Name": "Power" },{ "ID": "1111","Object_Name": "Automate" },{ "ID": "2222","Object_Name": "Function"} ] |
 | [ { "ID": "1111","Size": "5" },{ "ID": "2222","Size": "6" },{ "ID": "3333","Size": "8" },{ "ID": "4444","Size": "8" } ] |
 | "Array": @{outputs('Array2')} |
 | xml(outputs('PrepareArray2')) |
 | Using a Compose step to check the xpath() construction xpath(outputs('XML'),concat('//Array[ID/text()="', item()['ID'],'"]/Size/text()'))[0] |
The output from XML is
<root>
<Array>
<ID>1111</ID>
<Size>5</Size>
</Array>
<Array>
<ID>2222</ID>
<Size>6</Size>
</Array>
<Array>
<ID>3333</ID>
<Size>8</Size>
</Array>
<Array>
<ID>4444</ID>
<Size>8</Size>
</Array>
</root>
The error message from the Compose Stage

InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language expression 'xpath(outputs('XML'),concat('//Array[ID/text()="', item()['ID'],'"]/Size/text()'))[0]' cannot be evaluated because property 'ID' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.
I have also tried item()?['ID']. No error message but returns an empty array.
Any guidance would be greatly appreciated.
Thank you for your time.
Alex