Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2
This is the forum to discuss the Wrox book Beginning XML, 4th Edition by David Hunter, Jeff Rafter, Joe Fawcett, Eric van der Vlist, Danny Ayers, Jon Duckett, Andrew Watt, Linda McKinnon; ISBN: 9780470114872
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2 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
Thread Tools Display Modes
  #1 (permalink)  
Old April 13th, 2010, 05:47 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 How to get single result

Hi All,

This is my xml :

<?xml version="1.0" encoding="UTF-8"?>
<person name="John"/>
<person name="charlie"/>
<person name="Lee"/>
<cheese name="Camembert"/>
<cheese name="Brie"/>
<liking person="John" cheese="Camembert"/>
<liking person="John" cheese="Brie"/>
<liking person="Lee" cheese="Brie"/>
I want to write XQuery which will return only a pair of people based on there similar liking of chees. In the above case it shuld return 'John' and 'Lee'.

Below is my XQuery but I am not getting the desired result, could you please help to get the right result.


let $doc := doc('CheeseEaters.xml')
for $vper in $doc//person
for $xchz in $doc//cheese
for $plink in $doc//liking
$vper/@name = $plink/@person and $xchz/@name=$plink/@cheese    
{xs:string ($vper/@name )}
I am getting the below result:

<?xml version="1.0" encoding="UTF-8"?>


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
GridView and SQL More than one result = one result DarkForce ASP.NET 2.0 Basics 0 July 20th, 2007 04:29 AM
Single crmpicco Excel VBA 2 May 10th, 2005 03:57 AM
How many Result? Mantis PHP Databases 1 April 15th, 2005 03:37 PM
ASP.Net Single Single-on with Oracle Application S guhanath Oracle 0 October 6th, 2004 05:05 AM

All times are GMT -4. The time now is 12:02 PM.

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