1

In a Logic Apps For Each, I am iterating over part of an XML document that has, in part:

<Part ref="1">

I want to read out the attribute value only. In this case, "1". I have tried:

xpath(xml(item()),'Part/@ref')

and I get

["ref=\"1\""]

With

first(xpath(xml(item()),'Part/@ref'))

I get

ref="1"

I have tried incorporating string() and value() functions to no avail. What is the proper way to read out just the value?

2 Answers 2

3

Try this expression :

'string(//Part/@ref)'
Sign up to request clarification or add additional context in comments.

Comments

0

You have to use this expression in Code View:

@xpath(xml(item()), 'string(/*[local-name()=\"Part\" and namespace-uri()=\"\"]/@*[local-name()=\"ref\" and namespace-uri()=\"\"])')

2 Comments

Thank you felixmondelo. That does work for me. Specifically in code view I used: "@{xpath(xml(item()), 'string(/*[local-name()=\"Part\" and namespace-uri()=\"\"]/@*[local-name()=\"ref\" and namespace-uri()=\"\"])')}" or in designer: xpath(xml(item()), 'string(/*[local-name()="Part" and namespace-uri()=""]/@*[local-name()="ref" and namespace-uri()=""])') But, I am using as successfully the suggestion from Gilles Quenot as it is much simpler and I have to document and explain for others.
Yes, I agree - both are correct. I wish I could mark both as correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.