Xpath: Simple condition Check and assign value in Xpath Expression



I need do a check condition and if the condition not satisfies need to hard code the value. Below is my xml.


I need to check the condition like inside subroot- if ItemType=Table1 and ItemCondition=Chair1 then i have to give a hard coded value 'Proceed'( this hard coded value i will map to target side)



<Root>
<SubRoot>
<ItemType>Table1</ItemType>
<ItemCondition>Chair1</ItemCondition>
<ItemValue>
.......
</ItemValue>
</SubRoot>
<SubRoot>
<ItemType>Table2</ItemType>
<ItemCondition>chair2</ItemCondition>
<ItemValue>
.......
</ItemValue>
</SubRoot>
</Root>


I have tried like this but not seems to be working



/Root/SubRoot[ItemType='Table1' and ItemCondition='Chair1']='Proceed'


Could you please anyone help on this. Thanks in advance.


No comments:

Post a Comment