1

I have below xml :

<root>
    <steps>
        <step Name="test1" >
        <stepDetails Name = "exception" />
        <steps Name="1" />
        </step>
        <step Name="test2" >
        <steps Name="2" />
        </step>
        <step Name="test3" >
        <steps Name="3" />
        </step>
        <step Name="test4" >
        <stepDetails Name = "valid" />
        <steps Name="1" />
        </step>
    </steps>
<root>

I wan to get the name of all Steps except those having StepDetails name as 'exception'. Please note that StepDetails is not present in all Step.

In this example, I should receive the output as test2, test3 and test3

1 Answer 1

2

xpath expression:

//step[./stepDetails/@Name != 'exception' or not(./stepDetails)]/@Name
Sign up to request clarification or add additional context in comments.

Comments

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.