Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0
This is the forum to discuss the Wrox book XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition by Michael Kay; ISBN: 9780470192740
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 24th, 2010, 02:30 PM
Authorized User
Points: 437, Level: 7
Points: 437, Level: 7 Points: 437, Level: 7 Points: 437, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: , , .
Posts: 85
Thanks: 10
Thanked 0 Times in 0 Posts
Default Retrieve distinct values from xml using xpath

Hi All,

how can I retieve distinct values from xml document using xpath.

from the below Xml i want to retrieve all the user's name for example 'YU','john' etc. Once

how can I do that using xpath expression.

Code:
 
<?xml version="1.0" encoding="utf-8"?>
<ACF>
  <form name="Customer Information of category" default="">
    <user name="Yu" id="55758" >
      <department>Development</department>
    </user>
    <user name="john" id="56308">
      <department>Development</department>
    </user>
    <user name="Sid" id="56309" >
      <department>Development</department>
    </user>
    <user name="Harry" id="56198" >
      <department>Development</department>
    </user>
  </form>
  <form name="Department Information Testing" default="">
   <user name="Yu" id="55758" >
      <department>Development</department>
    </user>
    <user name="john" id="56308">
      <department>Development</department>
    </user>
    <user name="Sid" id="56309" >
      <department>Development</department>
    </user>
    <user name="Harry" id="56198" >
      <department>Development</department>
    </user>
  </form>
  <form name="Department Information Testing" default="">
   <user name="Yu" id="55758" >
      <department>Development</department>
    </user>
    <user name="john" id="56308">
      <department>Development</department>
    </user>
    <user name="Sid" id="56309" >
      <department>Development</department>
    </user>
    <user name="Harry" id="56198" >
      <department>Development</department>
    </user>
  </form>  
</ACF>

Thank you very much.
-Nelly
Reply With Quote
  #2 (permalink)  
Old March 24th, 2010, 07:07 PM
mhkay's Avatar
Wrox Author
Points: 18,356, Level: 59
Points: 18,356, Level: 59 Points: 18,356, Level: 59 Points: 18,356, Level: 59
Activity: 60%
Activity: 60% Activity: 60% Activity: 60%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,943
Thanks: 0
Thanked 286 Times in 281 Posts
Default

Code:
distinct-values(//user/@name)
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Distinct Values 1.0 musman0047 XSLT 2 February 25th, 2009 03:48 PM
List of Distinct values using xpath and javascript pnviv XSLT 4 November 5th, 2007 05:52 AM
XPATH: Retrieve Value without namespace prefixes ramesh.kumarm XSLT 4 September 14th, 2006 03:50 AM
How to use XPath to retrieve a node tag rs:data? y10k XML 1 May 5th, 2006 01:11 PM
distinct-values in Javascript Jan1 XML 2 October 10th, 2005 04:56 AM



All times are GMT -4. The time now is 07:13 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.