web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / xPath Query to remove ...
Power Automate
Unanswered

xPath Query to remove an Element when parents has attributes

(0) ShareShare
ReportReport
Posted on by

We read a xml file and want to remove a tag, but everytime when the parent has an attribute the element can't be selected.

For example 

<ParentNode att1="notempty" att2="notempty"/>

<childNode/>

</ParentNode>

 

We are using xpath query : ParentNode/childNode, but this query is not deleting or removing the child element.

 

Any solution?

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @Patrick83 

     

    Looks like there is a typo in the source XML text. It should be like:

    <ParentNode att1="notempty" att2="notempty">
    <childNode/>
    </ParentNode>

    As per my understanding, you want to fetch the childNode if ParentNode has a value in att1 attribute, to get that node pls use the below expression:

    xpath(xml(outputs('Compose_3')),'ParentNode[@att1="notempty"]/childNode')

    Pls replace outputs('Compose_3') with the actual valid xml input and attribute name & value as per you need.

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard