Re: [basex-talk] id function in BaseX
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 bencompan...@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.francesc...@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-syntax3.html 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 ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] id function in BaseX
Il giorno 31/ott/2012, alle ore 14:39, Michael Seiferle ha scritto: 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. Thanks Michael, this explains the failure. Strange behavior, anyway. I know that ID-type attributes can have any name, not necessarily the name id. Is BaseX behavior coherent with W3C specifications? Best, Massimo ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] id function in BaseX
Hi Massimo, sorry, I'm a little in a hurry: The spec states: http://www.w3.org/TR/xpath-datamodel/#dm-is-id Exactly what constitutes an ID depends in part on how the data model was constructed, see 6.2 Element Nodes and 6.3 Attribute Nodes. which says: is-id If the attribute is named xml:id and its [attribute type] property does not have the value ID, then [xml:id] processing is performed. This will assure that the value does have the type ID and that it is properly normalized. If an error is encountered during xml:id processing, an implementation may raise a dynamic error. The is-id property is always true for attributes named xml:id. as BaseX does not check/care for the types when parsing, we follow: The is-id property is always true for attributes named xml:id. I hope I read the spec right; others will correct me :-) Best Michael Am 31.10.2012 um 14:44 schrieb Massimo Franceschet massimo.francesc...@uniud.it: Il giorno 31/ott/2012, alle ore 14:39, Michael Seiferle ha scritto: 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. Thanks Michael, this explains the failure. Strange behavior, anyway. I know that ID-type attributes can have any name, not necessarily the name id. Is BaseX behavior coherent with W3C specifications? Best, Massimo ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] id function in BaseX
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.francesc...@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-syntax3.html 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