Say I have a collection c with xml documents x.xml, y.xml, and z.xml and that I've added them using "to" so that they are found here:
collection('c/x') ...
Let's say that in each document I have a node <code/>, so in x.xml I have <code id='1'/>, in y.xml I have <code id='2'/>, etc.
I can query across the documents to find the <code/> node with id = 2 pretty easily. But now that I've found it, I want to do further queries limiting myself to that document. In other words, I want to learn using XQuery that the <code/> node with id = 2 is in collection('c/y').
How can I do this?
TIA, Chas.
Hi Chas,
you could use the function fn:document-uri(): http://www.w3.org/TR/xpath- functions/#func-document-uri . A working example which I tested with BaseX is
//code[@id = '2']/root()/document-uri()
Cheers, Dimitar
Am Montag 30 Mai 2011, 03:03:19 schrieb chas@munat.com:
Say I have a collection c with xml documents x.xml, y.xml, and z.xml and that I've added them using "to" so that they are found here:
collection('c/x') ...
Let's say that in each document I have a node <code/>, so in x.xml I have <code id='1'/>, in y.xml I have <code id='2'/>, etc.
I can query across the documents to find the <code/> node with id = 2 pretty easily. But now that I've found it, I want to do further queries limiting myself to that document. In other words, I want to learn using XQuery that the <code/> node with id = 2 is in collection('c/y').
How can I do this?
TIA, Chas.
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de