Below is the XML and I am looking for output as below
Input XML (xml version="1.0")
<dynamic>
<rpc xmlns="http://namespace/example" >
<route>
<table>
<tablename>employee</tablename>
<count>20</count>
</table>
<table>
<tablename>employee</tablename>
<count> 21</count>
<rt> 1</rt>
<rt> 2</rt>
<rt> 3</rt>
<rt> 4</rt>
</table>
<table>
<tablename>dept</tablename>
<count>20</count>
<rt> a</rt>
<rt> b</rt>
<rt> c</rt>
</table>
<table>
<tablename>dept</tablename>
<count>44</count>
<rt> d</rt>
<rt> e</rt>
<rt> g</rt>
</table>
</route>
</rpc>
</dynamic>
Please note, only the first <count>
value needs to be selected
Output XML
<dynamic>
<rpc xmlns="http://namespace/example">
<route>
<table>
<tablename>employee</tablename>
<count>20</count>
<rt> 1</rt>
<rt> 2</rt>
<rt> 3</rt>
<rt> 4</rt>
</table>
<table>
<tablename>dept</tablename>
<count>20</count>
<rt> a</rt>
<rt> b</rt>
<rt> c</rt>
<rt> d</rt>
<rt> e</rt>
<rt> g</rt>
</table>
</route>
</rpc>
</dynamic>