Reputation: 29
The below data is xml file. Here actual,msg,time,type are attributes.
<properties>
<inputs>
<action actual="0xAB" msg="GENERAL.GROUPING.TAG" time="00:00:00.825" type="SET" />
<action actual="0xCD" msg="GENERAL.GROUPING.LENGTH" time="00:00:00.826" type="SET" />
<action actual="0xEF" msg="GENERAL.GROUPING.TRANSACTION_ID" time="00:00:00.826" type="SET" />
<action actual="0xGH" msg="GENERAL.GROUPING.ORIGINATOR_SYSTEM_TITLE" time="00:00:00.827" type="SET" />
<action actual="0xIJ" msg="GENERAL.GROUPING.VALUE" time="00:00:00.827" type="SET" />
<action actual="0xKL" msg="GENERAL.GROUPING.TITLE.LENGTH" time="00:00:00.827" type="SET" />
<action actual="0xMN" msg="GENERAL.GROUPING.TITLE.VALUE" time="00:00:00.828" type="SET" />
<action actual="0xOP" msg="GENERAL.GROUPING.DATE" time="00:00:00.828" type="SET" />
</inputs>
</properties>
I want to return attribute value of actual="0xAB"
when attribute msg="GENERAL.GROUPING.TAG"
.
So depending on attribute 'msg' value I want to print attribute 'actual' value
Kindly help in this issue with example.
Upvotes: 0
Views: 202
Reputation: 29042
You can use this XPath-1.0 expression:
//action[@msg='GENERAL.GROUPING.TAG']/@actual
It returns the attribute value 0xAB
.
Upvotes: 1