|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Need simple xquery helpDavid Carlisle davidc at nag.co.ukThu Dec 20 22:35:23 PST 2007
> 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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






