Logical XPath Expression
Hi,
I am having trouble extracting node set of records with unique Codes for each City.
For this I am first getting all the records nodeset for a city and then trying to get unique code nodeset from the city nodeset.
I tried using these XPath expressions.
DAL_OUTPUT/RECORD[(CITY ='NEWYORK')][(not(CODE = preceding-sibling::RECORD/CODE))]
DAL_OUTPUT/RECORD[(CITY ='NEWYORK') and (not(CODE = preceding-sibling::RECORD/CODE))]
I would really appreciate if someone can help me here.
Input xml is something like this:
<DAL_OUTPUT>
<RECORD>
<CITY>NEWYORK</CITY>
<CODE>1778</CODE>
</RECORD>
<RECORD>
<CITY>ATLANTA</CITY>
<CODE>1779</CODE>
</RECORD>
<RECORD>
<CITY>NEWYORK</CITY>
<CODE>1779</CODE>
</RECORD>
<RECORD>
<CITY>NEWYORK</CITY>
<CODE>1778</CODE>
</RECORD>
<RECORD>
<CITY>ATLANTA</CITY>
<CODE>1889</CODE>
</RECORD>
<RECORD>
<CITY>ATLANTA</CITY>
<CODE>1889</CODE>
</RECORD>
</DAL_OUTPUT>
|