|
XQuery question: msg#00186text.xml.exist
Hi, I am struggling with an xquery problem and I would be very grateful for any advice. I would like to collect all the nodes in result set, put them into a single string and eliminate the duplicate 'words'. I was hoping to uses something like fn:distinct-values($list-derived-from-nodeset) but I can't see how to flatten the nodeset into a string (or alternatively a list). The target fragment of xml is of this form: <links> <link id="x" n="y" targets="a b c d"/> <link id="p" n="q" targets="m e n q a"/> <link id="i" n="j" targets="u e a s d "/> ... </links> which in effect represents a many-to-one relationship @targets => @id each @targets will contain "a", but there are significant numbers of other duplicates, and I want a superset of the contents of the @targets. Can anyone point me in the right direction? I am currently using the following query let $query := concat('//links/link/@targets[. |= "' , $id , '"]'), $targets := util:eval($query) and using a for loop to iterate through $targets and perform pattern matches on the strings. This can take quite a while, and wastes a lot of effort because I end up processing the same values repeatedly. Thank you for any help you can offer. Jonathan Miller Learning Technologies Group Oxford University Computing Services ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: New snapshot: 00186, Wolfgang Meier |
|---|---|
| Next by Date: | Re: XUpdate - generating duplicate attributes: 00186, Wolfgang Meier |
| Previous by Thread: | Computed constructors in XQuery broken more badly than beforei: 00186, Amotz Anner |
| Next by Thread: | RE: XQuery question: 00186, Piotr Kaminski |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |