Hi Leonard, This makes my query work. I was experimenting with namespace declarations bevor posting the query but I made a syntax mistake trying to assign a name to the standard namespace as suggested by the xquery standard (i.e. Declare namespace xliff = "....". This did not work.
Thank you very much!
________________________________
Jörg Beisiegel Geschäftsführer / Managing Director Localization Consulting Desk phone: +49 7275 98933-22 mailto:joerg.beisiegel@translatissimo.de translatissimo Übersetzung und Lokalisierung GbR Bismarckstr. 19 * D-76870 Kandel * Germany http://www.translatissimo.de *** HINWEIS *** NOTE *** Falls die Mail Anhänge enthält, bitte Empfang bestätigen. If this mail contains attachments please confirm receipt.
-----Ursprüngliche Nachricht----- Von: Leonard Wörteler [mailto:leo@woerteler.de] Gesendet: Montag, 30. August 2010 15:11 An: basex-talk@mailman.uni-konstanz.de Cc: Jörg Beisiegel Betreff: Re: [basex-talk] bug in vb.net sample code for new query
Hi Jörg,
Am 30.08.2010 14:31, schrieb Jörg Beisiegel:
The root element looks like: <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:anotherNamespace="http://www.anotherNameSpace.com/some/element" version="1.2">
I can perform a full text search on all attributes such as //@id or count(//@id) returning over 6000 hits. Performing a query for an element i.e. //note/ does not find any hits although there are note elements containing text in the file.
that's a common misconception of people new to namespaces in XQuery. The namespace without prefix, e.g.
xmlns="urn:oasis:names:tc:xliff:document:1.2"
is the default namespace of all the elements below it. As the <node/>-elements thus have a non-empty namespace, they aren't found by the query //node (implying am empty NS).
There are two solutions:
1. As this is the default element namespace, you could simply declare it in your query:
declare default element namespace "urn:oasis:names:tc:xliff:document:1.2"; //note
2. Generally you can also bind it to a prefix and use that in your query:
declare namespace xliff = "urn:oasis:names:tc:xliff:document:1.2"; //xliff:note
I hope this helps, Cheers Leo