Hi Massimo, Hi Ben,
BaseX has no direct support for extracting the information, that for a given document the ID is renamed to "@key" (even with help of a DTD). This is why those example queries fail to function as expected. BaseX will however work if the ID attribute is named @id.
Long story short: you can mimic this behaviour, which you might have already known by running:
declare function local:id($id as xs:string, $nodes as node()){ $nodes//*[@key = $id] }; local:id("M4M05", .)
or if you do not want to wrap it in a function,
//*[@key = "M4M05"]
Hope this helps Michael
Am 29.10.2012 um 19:22 schrieb Ben Companjen bencompanjen@gmail.com:
This is just a guess, but did you include the DTD? As the document says: "Notice that the id() functions works only if you have properly declared the ID and IDREF attributes in the document DTD."
Ben
On 29 October 2012 13:49, Massimo Franceschet massimo.franceschet@uniud.it wrote:
Hi.
I'm trying to use the XPath id function with BaseX (GUI interface) with no success. For instance, I'm querying the bibliographic XML document found at http://users.dimi.uniud.it/~massimo.franceschet/caffe-xml/xpath/xpath-syntax... with the id queries written below in this page, for instance, id("M4M05"). The query is parsed correctly by BaseX but the result is always empty.
Cheers,
Massimo Franceschet _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk