[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Need simple xquery help

David Carlisle davidc at nag.co.uk
Thu Dec 20 22:35:23 PST 2007


  Need simple xquery help
> The following query returns ALL the 'mfgs' - I don't understand why the
> "where" doesn't restrict it to only the Nelson entry.

$pngroup is the group you want but
$pmgroup/../../.. is the manufacture element so

$pmgroup/../../../mfg

selects all the mfg children of manufacture.

what you want is the mfg that's the gradparent of teh pmgroup select so
that's

$pmgroup/../..

Or more simply replace

for $pmgroup in
doc("file:example.xml")/pmcatalog/manufacture/mfg/pmdata/pmgroup
where contains($pmgroup/keyword, "pgroup8") 
return $pmgroup/../..

by

doc("file:example.xml")/pmcatalog/manufacture/mfg[contains(pmdata/pmgroup/keyword,"pgroup8")]



> But how does one retrieve only the node "header" (for lack of a term to use)
> - without its subsequent children.  Picking and choosing nodes with their
> attributes without the children.

The children of a node are an intrinsic property of the node (as is its
parent) if you just want an element node with the same name, but without
the children and parent of the node in the source then you need to
construct a new node, as you observed.

David


Purchase Stylus Studio Online Today!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.