-1

From the below xml,i need an xpath to take the id value only when the state is FL.

Please help

<Employee_Details>
<Payroll>
    <id>A1</id>
    <City>Dallas</City>
    <State>TX</State>
</Payroll>
<Payroll>
    <id>A2</id>
    <City>Orlando</City>
    <State>FL</State>
</Payroll>

Ram
  • 1
  • 1
  • Unless you have tried something and failed, this is duplicate of [xpath select parent based on child value](http://stackoverflow.com/questions/24898248/xpath-select-parent-based-on-child-value) – har07 Feb 24 '16 at 01:39

1 Answers1

0

"i need an xpath to take the id value only when the state is FL"

That can be translated into the following XPath expression :

/Employee_Details/Payroll[State='FL']/id

maybe you want to append /text() at the end to return the text node inside <id> element instead of the element itself.

har07
  • 88,338
  • 12
  • 84
  • 137