Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 23rd, 2004, 11:29 AM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>






Similar Threads
Thread Thread Starter Forum Replies Last Post
XPath 2.0 every expression stolte XSLT 5 November 24th, 2008 03:32 PM
XPath Expression NEO1976 XSLT 11 August 2nd, 2006 02:28 AM
Need help with XPATH Expression benomathew XSLT 1 May 12th, 2006 04:41 AM
Need help with XPATH Expression benomathew XML 1 May 9th, 2006 03:38 PM
Getting XPath Expression from XmlDocument ? boemane C# 3 August 31st, 2004 04:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.