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