[MarkLogic Dev General] sequence of elements
Florent Georges
lists at fgeorges.org
Tue Sep 7 03:29:32 PDT 2010
Geert Josten wrote:
Hi,
> > <x>{$item/self::*[local-name(.) eq "ID"]}</x>
> Not likely quicker, but more readible if you write it like this:
> <x>{$item/self::*:ID}</x>
Well, to be really correct, the OP should prevent matches
within other namespaces as well:
<x>{ $item/self::*:ID[namespace-uri(.) eq ''] }</x>
But as I said, this is relying on string information extraction
out of the element name, and string comparison, whilst the
following expression is both simpler to read and use the built-in
processor ability to use QNames, as long as you don't use the
default namespace statement:
<x>{ $item/self::ID }</x>
So probably the question now is: why does the OP need the
default namespace statement?
Regards,
--
Florent Georges
http://fgeorges.org/
More information about the General
mailing list